Version Description
We've significantly improved the drag and drop experience (and we've also fixed some bugs)
Download this release
Release Info
Developer | galdub |
Plugin | Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager |
Version | 2.5.9 |
Comparing to | |
See all releases |
Code changes from version 2.5.8 to 2.5.9
- assets/css/admin-setting.css +1 -1
- assets/css/design.css +74 -68
- assets/css/design.min.css +1 -1
- assets/css/folders.css +165 -0
- assets/css/folders.min.css +1 -0
- assets/css/jstree.css +1113 -0
- assets/css/jstree.min.css +1 -0
- assets/css/page-post-media.css +11 -48
- assets/css/page-post-media.min.css +1 -1
- assets/css/select2.min.css +1 -1
- assets/images/32px.png +0 -0
- assets/images/40px.png +0 -0
- assets/js/folders.js +2245 -0
- assets/js/folders.min.js +1 -0
- assets/js/jstree.js +8701 -0
- assets/js/jstree.min.js +1 -0
- assets/js/page-post-media.js +652 -445
- assets/js/page-post-media.min.js +1 -1
- folders.php +2 -2
- includes/folders.class.php +73 -46
assets/css/admin-setting.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@import url(https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap);*,:after,:before{box-sizing:border-box}#wpwrap{background:#6572db;background:-moz-linear-gradient(-45deg,#6572db 0,#ee86c6 67%,#ee86c6 100%);background:-webkit-gradient(left top,right bottom,color-stop(0,#6572db),color-stop(67%,#ee86c6),color-stop(100%,#ee86c6));background:-webkit-linear-gradient(-45deg,#6572db 0,#ee86c6 67%,#ee86c6 100%);background:-o-linear-gradient(-45deg,#6572db 0,#ee86c6 67%,#ee86c6 100%);background:-ms-linear-gradient(-45deg,#6572db 0,#ee86c6 67%,#ee86c6 100%);background:linear-gradient(135deg,#6572db 0,#ee86c6 67%,#ee86c6 100%)}.pricing-table{margin:0 0 45px;color:#28375a;font-size:16px;line-height:25px;font-family:Lato,sans-serif}.price-title{font-weight:700;font-size:24px;line-height:30px;color:#28375a;text-align:center}.price-table{background:#fff;box-sizing:border-box;border-radius:10px}.price-table-top{padding:20px;position:relative;border-radius:10px}.price-table.basic-feature{box-shadow:0 12px 44px rgba(108,203,255,.2);border:2px solid #b9eafd}.price-table.basic-feature .price-table-top{background:url(../images/basic-price-bg.png) no-repeat left top}.price-table.plus-feature{border:2px solid #f9d9bd;box-shadow:0 12px 44px rgba(239,140,106,.2)}.price-table.plus-feature .price-table-top{background:url(../images/plus-price.png) no-repeat left top}.price-table.agency-feature{border:2px solid #cfd3fb;box-shadow:0 12px 44px rgba(96,93,236,.2)}.price-table.agency-feature .price-table-top{background:url(../images/agency-price.png) no-repeat left top}.price-tables{margin:30px 0 50px}.plan-name{font-size:30px;line-height:36px;font-weight:700;color:#28375a}.plan-price{position:absolute;right:18px;top:8px;font-weight:700;font-size:60px;line-height:72px;color:#42b9fa}.price-table.plus-feature .plan-price{color:#ef8c6a}.price-table.agency-feature .plan-price{color:#605dec}.price-table.agency-feature .plan-name{color:#fff}.price-head{line-height:72px;padding:5px 0 25px 0}.price-offer,.price-websites{line-height:18px;font-size:15px}.cus-tooltip{cursor:pointer;display:inline-block;position:relative}.cus-tooltip .tooltip__content{background-color:#1849ab;border-radius:4px;bottom:150%;color:#fff;left:0;margin-left:15px;opacity:0;padding:5px 10px;position:absolute;transition:opacity .25s;visibility:hidden;width:auto;z-index:1;text-align:left;margin-right:15px;font-size:14px;line-height:20px}.cus-tooltip .tooltip__content::after{border-width:5px;border-style:solid;border-color:#1849ab transparent transparent transparent;content:"";left:25px;margin-left:-5px;position:absolute;top:100%}.cus-tooltip:hover .tooltip__content{opacity:1;visibility:visible}.price-table-middle ul{list-style:none;margin:0;padding:0}.price-table-middle ul li{display:block;width:100%;border-bottom:solid 1px #e9e9e9;padding:15px 0;margin:0}.price-table-middle ul li a{padding:0 15px;color:#28375a;font-size:16px;line-height:19px;display:block;text-decoration:none}span.has-tooltip{color:#605dec}.price-table-bottom{padding:15px}.custom-dd-btn{background:#fff;border:1px solid #e9e9e9;border-radius:6px;height:40px;line-height:40px;width:100%;text-align:left;padding:0 15px}.custom-dd{margin-bottom:15px}.price-table-bottom a{background:#fff;border:1px solid #42b9fa;color:#42b9fa;border-radius:20px;height:40px;line-height:38px;padding:0 15px;display:block;text-align:center;transition:all .25s linear}.price-table-bottom a:hover{color:#fff;background:#42b9fa}.price-table.plus-feature .price-table-bottom a{background:#ef8c6a;border:1px solid #ef8c6a;color:#fff}.price-table.plus-feature .price-table-bottom a:hover{background:#fff;color:#ef8c6a}.price-table.agency-feature .price-table-bottom a{background:#fff;border:1px solid #605dec;color:#605dec}.price-table.agency-feature .price-table-bottom a:hover{background:#605dec;color:#fff}.container{max-width:1180px;width:100%;padding:30px;background:#fff;border-radius:15px;margin:50px auto}.row{margin-right:-15px;margin-left:-15px}.col-md-4{padding-right:15px;padding-left:15px;width:33.33333333%;float:left}.select2-container--default .select2-selection--single{background:#fff;border:1px solid #e9e9e9;border-radius:6px;height:40px;line-height:40px;width:100%;text-align:left;padding:0 15px;outline:0}span.select2.select2-container{width:100%!important}.website-package{padding:0 15px;line-height:18px}.
|
1 |
+
@import url(https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap);*,:after,:before{box-sizing:border-box}#wpwrap{background:#6572db;background:-moz-linear-gradient(-45deg,#6572db 0,#ee86c6 67%,#ee86c6 100%);background:-webkit-gradient(left top,right bottom,color-stop(0,#6572db),color-stop(67%,#ee86c6),color-stop(100%,#ee86c6));background:-webkit-linear-gradient(-45deg,#6572db 0,#ee86c6 67%,#ee86c6 100%);background:-o-linear-gradient(-45deg,#6572db 0,#ee86c6 67%,#ee86c6 100%);background:-ms-linear-gradient(-45deg,#6572db 0,#ee86c6 67%,#ee86c6 100%);background:linear-gradient(135deg,#6572db 0,#ee86c6 67%,#ee86c6 100%)}.pricing-table{margin:0 0 45px;color:#28375a;font-size:16px;line-height:25px;font-family:Lato,sans-serif}.price-title{font-weight:700;font-size:24px;line-height:30px;color:#28375a;text-align:center}.price-table{background:#fff;box-sizing:border-box;border-radius:10px}.price-table-top{padding:20px;position:relative;border-radius:10px}.price-table.basic-feature{box-shadow:0 12px 44px rgba(108,203,255,.2);border:2px solid #b9eafd}.price-table.basic-feature .price-table-top{background:url(../images/basic-price-bg.png) no-repeat left top}.price-table.plus-feature{border:2px solid #f9d9bd;box-shadow:0 12px 44px rgba(239,140,106,.2)}.price-table.plus-feature .price-table-top{background:url(../images/plus-price.png) no-repeat left top}.price-table.agency-feature{border:2px solid #cfd3fb;box-shadow:0 12px 44px rgba(96,93,236,.2)}.price-table.agency-feature .price-table-top{background:url(../images/agency-price.png) no-repeat left top}.price-tables{margin:30px 0 50px}.plan-name{font-size:30px;line-height:36px;font-weight:700;color:#28375a}.plan-price{position:absolute;right:18px;top:8px;font-weight:700;font-size:60px;line-height:72px;color:#42b9fa}.price-table.plus-feature .plan-price{color:#ef8c6a}.price-table.agency-feature .plan-price{color:#605dec}.price-table.agency-feature .plan-name{color:#fff}.price-head{line-height:72px;padding:5px 0 25px 0}.price-offer,.price-websites{line-height:18px;font-size:15px}.cus-tooltip{cursor:pointer;display:inline-block;position:relative}.cus-tooltip .tooltip__content{background-color:#1849ab;border-radius:4px;bottom:150%;color:#fff;left:0;margin-left:15px;opacity:0;padding:5px 10px;position:absolute;transition:opacity .25s;visibility:hidden;width:auto;z-index:1;text-align:left;margin-right:15px;font-size:14px;line-height:20px}.cus-tooltip .tooltip__content::after{border-width:5px;border-style:solid;border-color:#1849ab transparent transparent transparent;content:"";left:25px;margin-left:-5px;position:absolute;top:100%}.cus-tooltip:hover .tooltip__content{opacity:1;visibility:visible}.price-table-middle ul{list-style:none;margin:0;padding:0}.price-table-middle ul li{display:block;width:100%;border-bottom:solid 1px #e9e9e9;padding:15px 0;margin:0}.price-table-middle ul li a{padding:0 15px;color:#28375a;font-size:16px;line-height:19px;display:block;text-decoration:none}span.has-tooltip{color:#605dec}.price-table-bottom{padding:15px}.custom-dd-btn{background:#fff;border:1px solid #e9e9e9;border-radius:6px;height:40px;line-height:40px;width:100%;text-align:left;padding:0 15px}.custom-dd{margin-bottom:15px}.price-table-bottom a{background:#fff;border:1px solid #42b9fa;color:#42b9fa;border-radius:20px;height:40px;line-height:38px;padding:0 15px;display:block;text-align:center;transition:all .25s linear}.price-table-bottom a:hover{color:#fff;background:#42b9fa}.price-table.plus-feature .price-table-bottom a{background:#ef8c6a;border:1px solid #ef8c6a;color:#fff}.price-table.plus-feature .price-table-bottom a:hover{background:#fff;color:#ef8c6a}.price-table.agency-feature .price-table-bottom a{background:#fff;border:1px solid #605dec;color:#605dec}.price-table.agency-feature .price-table-bottom a:hover{background:#605dec;color:#fff}.container{max-width:1180px;width:100%;padding:30px;background:#fff;border-radius:15px;margin:50px auto}.row{margin-right:-15px;margin-left:-15px}.col-md-4{padding-right:15px;padding-left:15px;width:33.33333333%;float:left}.select2-container--default .select2-selection--single{background:#fff;border:1px solid #e9e9e9;border-radius:6px;height:40px;line-height:40px;width:100%;text-align:left;padding:0 15px;outline:0}span.select2.select2-container{width:100%!important}.website-package{padding:0 15px;line-height:18px}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:#fff}.website-package .select2-container--default .select2-results>.select2-results__options{margin-top:5px}.custom-dd .select2-container--default .select2-selection--single .select2-selection__arrow{height:20px;top:10px;right:1px;width:20px}@media (min-width:768px){.col-sm-4{width:100%;float:none}}a,a:focus,a:hover{text-decoration:none}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:38px}.select2-results__option{user-select:none;-webkit-user-select:none;font-size:14px;padding:8px 25px;margin:0}.select2-dropdown{border:1px solid #e9e9e9}.price-after{padding:0;text-align:center;font-size:16px;line-height:25px;font-family:Lato,sans-serif}.price-after p,.price-after span{font-size:16px;line-height:25px;margin:0;padding:0}.clearfix{clear:both}.price-after span{display:inline-block;vertical-align:text-top;font-size:20px;color:#42b9fa}.payments{padding:20px 0 10px}.folder-testimonial-list{width:100%;margin:30px auto 0;font-family:Lato,sans-serif}.folder-testimonial{position:relative}.folder-testimonial .testimonial-image{position:absolute;height:60px;width:60px;top:50%;margin-top:-30px;z-index:1;overflow:hidden;border-radius:30px}.folder-testimonial .testimonial-image img{width:100%;height:auto}.folder-testimonial .testimonial-data{position:relative;margin-left:30px;font-size:16px;line-height:22px;padding:10px 10px 10px 40px;background:#f5f5f5;border-radius:4px}.testimonial-title{font-weight:700;font-size:18px;padding:0 0 5px}.testimonial-author{font-size:16px;font-style:italic;font-weight:500;padding:5px 0 0}.plan-price span{font-size:16px;color:#28375a}.price-table-middle{margin-top:20px}.agency-feature .price-table-middle{margin-top:0}.website-package .select2-container--default .select2-selection--single{border:1px solid #6156f6;box-shadow:0 12px 44px rgba(96,93,236,.2)}.website-package .select2-container--default .select2-selection--single .select2-selection__rendered{color:#6156f6}.website-package .select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#6156f6 transparent transparent transparent}.website-package .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #6156f6 transparent;border-width:0 4px 5px 4px}
|
assets/css/design.css
CHANGED
@@ -18,6 +18,7 @@
|
|
18 |
margin: 0;
|
19 |
padding: 0;
|
20 |
top: 0;
|
|
|
21 |
max-height: 100% !important;
|
22 |
width: 100%;
|
23 |
border-radius: 2px;
|
@@ -255,6 +256,15 @@ button#wcp-save-folder {
|
|
255 |
line-height: 26px;
|
256 |
display: none;
|
257 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
body:not(.no-hover-css) .wcp-container .route .title:hover {
|
259 |
background: rgba(250, 22, 107, 0.08);
|
260 |
cursor: pointer
|
@@ -265,11 +275,14 @@ body:not(.no-hover-css) .wcp-container .route .title:hover {
|
|
265 |
body:not(.no-hover-css) .wcp-container .route .title:hover > .star-icon, body:not(.no-hover-css) .wcp-container .route .title:hover > .folder-sticky-icon {
|
266 |
display: none !important;
|
267 |
}
|
268 |
-
body:not(.no-hover-css) .wcp-container .route .title:hover .
|
269 |
-
display:
|
270 |
}
|
271 |
body:not(.no-hover-css) .wcp-container .route .title:hover .ui-icon .pfolder-folder-close:before, body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .ui-icon .pfolder-folder-close:before {
|
272 |
-
|
|
|
|
|
|
|
273 |
}
|
274 |
.route.is-sticky > h3.title > .ui-icon > .folder-sticky-icon {
|
275 |
display: block;
|
@@ -281,9 +294,9 @@ body:not(.no-hover-css) .wcp-container .route .title:hover .ui-icon .pfolder-fol
|
|
281 |
filter: invert(100%);
|
282 |
-webkit-filter: invert(100%);
|
283 |
}
|
284 |
-
|
285 |
display: none;
|
286 |
-
}
|
287 |
.wcp-container .route .title.wcp-drop-hover img {
|
288 |
filter: invert(100%);
|
289 |
-webkit-filter: invert(100%);
|
@@ -444,9 +457,6 @@ span.total-count {
|
|
444 |
#custom-menu .route.active .nav-icon .wcp-icon {
|
445 |
transform: rotate(0deg);
|
446 |
}
|
447 |
-
#custom-menu .route.active > h3.title .pfolder-folder-close:before {
|
448 |
-
content: "\e902";
|
449 |
-
}
|
450 |
.route.active > .nav-icon > .folder-icon-arrow_right {
|
451 |
transform: rotate(90deg);
|
452 |
-webkit-transform: rotate(90deg);
|
@@ -472,7 +482,8 @@ span.total-count {
|
|
472 |
}
|
473 |
.dynamic-menu {
|
474 |
position: absolute;
|
475 |
-
left:
|
|
|
476 |
background: #fff;
|
477 |
width: 170px;
|
478 |
padding: 0;
|
@@ -488,13 +499,13 @@ span.total-count {
|
|
488 |
.dynamic-menu li {
|
489 |
position: relative;
|
490 |
width: 100%;
|
491 |
-
display:
|
492 |
padding: 2px 0;
|
493 |
margin: 0
|
494 |
}
|
495 |
.dynamic-menu a {
|
496 |
text-decoration: none;
|
497 |
-
color: #
|
498 |
position: relative;
|
499 |
display: block;
|
500 |
padding: 5px 10px;
|
@@ -540,6 +551,11 @@ span.total-count {
|
|
540 |
.dynamic-menu ul li span.sticky-folder-icon {
|
541 |
width: 20px;
|
542 |
}
|
|
|
|
|
|
|
|
|
|
|
543 |
.wcp-form-input {
|
544 |
padding-left: 35px;
|
545 |
box-sizing: border-box;
|
@@ -733,43 +749,13 @@ span.wcp-item {
|
|
733 |
cursor: col-resize
|
734 |
}
|
735 |
div#custom-menu {
|
736 |
-
padding: 10px;
|
737 |
background: #ffffff;
|
738 |
box-shadow: 0px 4px 21px rgba(7, 16, 28, 0.1);
|
739 |
}
|
740 |
-
.wcp-container .route span.star-icon, .sticky-folders li a span.star-icon {
|
741 |
-
position: relative;
|
742 |
-
top: 2px;
|
743 |
-
left: auto;
|
744 |
-
float: right;
|
745 |
-
speak: none;
|
746 |
-
color: #ffc90e;
|
747 |
-
display: none;
|
748 |
-
font-size: 14px;
|
749 |
-
}
|
750 |
-
.wcp-container .route span.update-inline-record, .sticky-folders li a span.update-inline-record {
|
751 |
-
position: relative;
|
752 |
-
left: auto;
|
753 |
-
top: 0;
|
754 |
-
float: right;
|
755 |
-
width: 0;
|
756 |
-
height: 30px;
|
757 |
-
font-size: 16px;
|
758 |
-
overflow: hidden;
|
759 |
-
transition: all .25s linear;
|
760 |
-
-webkit-transition: all .25s linear;
|
761 |
-
-moz-transition: all .25s linear;
|
762 |
-
line-height: 30px;
|
763 |
-
}
|
764 |
body:not(.no-hover-css) .wcp-container .route h3:hover > span.update-inline-record, body:not(.no-hover-css) .sticky-folders li a:hover span.update-inline-record {
|
765 |
width: 18px
|
766 |
}
|
767 |
-
.sticky-folders li a:hover .folder-count {
|
768 |
-
margin: 0px 3px 0px 0px;
|
769 |
-
}
|
770 |
-
.wcp-container .route.is-high > h3 > span.star-icon, .sticky-folders li.is-high a span.star-icon {
|
771 |
-
display: block;
|
772 |
-
}
|
773 |
.tree-structure li {
|
774 |
display: block;
|
775 |
width: auto;
|
@@ -874,12 +860,14 @@ body:not(.no-hover-css) .wcp-container .route h3:hover > span.update-inline-reco
|
|
874 |
}
|
875 |
.mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail, .mCS-3d.mCSB_scrollTools .mCSB_draggerRail {
|
876 |
width: 2px !important;
|
877 |
-
background-color:
|
878 |
-
background-color: rgba(0, 115, 170, .6) !important;
|
879 |
box-shadow: none !important
|
880 |
}
|
881 |
.mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {
|
882 |
-
|
|
|
|
|
|
|
883 |
}
|
884 |
.mCSB_outside + .mCSB_scrollTools {
|
885 |
right: -15px !important
|
@@ -1186,7 +1174,7 @@ span.media-info-message.active {
|
|
1186 |
.wcp-container .folder-tooltip:not([flow])::after, .wcp-container .folder-tooltip[flow^=up]::after {
|
1187 |
bottom: calc(100% + 5px)
|
1188 |
}
|
1189 |
-
.wcp-container .folder-tooltip:not([flow])::after, .wcp-container .folder-tooltip:not([flow])::before, .wcp-container .folder-tooltip[flow^=up]::after, .folder-tooltip[flow^=up]::before {
|
1190 |
left: 50%;
|
1191 |
transform: translate(-50%, -.5em)
|
1192 |
}
|
@@ -1478,9 +1466,9 @@ select#media-attachment-taxonomy-filter {
|
|
1478 |
}
|
1479 |
.sticky-folders {
|
1480 |
display: none;
|
1481 |
-
padding: 0
|
1482 |
-
margin:
|
1483 |
-
border-
|
1484 |
}
|
1485 |
.top-settings {
|
1486 |
background: #fff;
|
@@ -1507,14 +1495,15 @@ select#media-attachment-taxonomy-filter {
|
|
1507 |
}
|
1508 |
.sticky-folders > ul > li > a {
|
1509 |
display: block;
|
1510 |
-
color: #
|
1511 |
-
padding:
|
1512 |
border-radius: 3px;
|
1513 |
text-decoration: none;
|
1514 |
-
font-size:
|
1515 |
-
line-height:
|
|
|
1516 |
}
|
1517 |
-
.sticky-folders ul li a:hover, .sticky-folders ul li a.active {
|
1518 |
background: #dfdfdf;
|
1519 |
border-radius: 3px;
|
1520 |
}
|
@@ -1526,19 +1515,18 @@ select#media-attachment-taxonomy-filter {
|
|
1526 |
filter: invert(100%);
|
1527 |
-webkit-filter: invert(100%);
|
1528 |
}
|
1529 |
-
.sticky-folders ul li a span {
|
1530 |
display: inline-block;
|
1531 |
vertical-align: middle;
|
1532 |
-
line-height:
|
1533 |
}
|
1534 |
-
.sticky-folders ul li a span.
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
}
|
1539 |
-
.sticky-folders ul li a span.
|
1540 |
-
|
1541 |
-
height: 100%;
|
1542 |
}
|
1543 |
.sticky-wcp-custom-form a:focus {
|
1544 |
box-shadow: none;
|
@@ -1546,13 +1534,11 @@ select#media-attachment-taxonomy-filter {
|
|
1546 |
}
|
1547 |
span.folder-count {
|
1548 |
float: right;
|
1549 |
-
background:
|
1550 |
-
padding: 0
|
1551 |
-
border: solid 1px #ccc;
|
1552 |
font-size: 10px;
|
1553 |
line-height: 16px;
|
1554 |
border-radius: 2px;
|
1555 |
-
color: #444 !important;
|
1556 |
}
|
1557 |
span.folder-count:empty {
|
1558 |
display: none;
|
@@ -1716,7 +1702,7 @@ span.folder-count:empty {
|
|
1716 |
transition: 300ms ease all;
|
1717 |
left: 0%;
|
1718 |
}
|
1719 |
-
#custom-menu [class^="pfolder-"], #custom-menu [class*=" pfolder-"] {
|
1720 |
font-size: 12px;
|
1721 |
}
|
1722 |
span.create_new_folder {
|
@@ -1776,6 +1762,26 @@ span.create_new_folder {
|
|
1776 |
.hide-folders-area .ui-resizable-handle.ui-resizable-e {
|
1777 |
display: none !important;
|
1778 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1779 |
@media screen and (max-width: 960px) {
|
1780 |
.wcp-content {
|
1781 |
left: 36px
|
18 |
margin: 0;
|
19 |
padding: 0;
|
20 |
top: 0;
|
21 |
+
margin-top: 0;
|
22 |
max-height: 100% !important;
|
23 |
width: 100%;
|
24 |
border-radius: 2px;
|
256 |
line-height: 26px;
|
257 |
display: none;
|
258 |
}
|
259 |
+
.wcp-container .route.is-sticky .title .folder-sticky-icon {
|
260 |
+
display: block;
|
261 |
+
}
|
262 |
+
span.folder-sticky-icon i {
|
263 |
+
font-size: 14px !important;
|
264 |
+
}
|
265 |
+
.mCS_no_scrollbar .mCSB_container.mCS_no_scrollbar_y.mCS_y_hidden {
|
266 |
+
overflow: visible;
|
267 |
+
}
|
268 |
body:not(.no-hover-css) .wcp-container .route .title:hover {
|
269 |
background: rgba(250, 22, 107, 0.08);
|
270 |
cursor: pointer
|
275 |
body:not(.no-hover-css) .wcp-container .route .title:hover > .star-icon, body:not(.no-hover-css) .wcp-container .route .title:hover > .folder-sticky-icon {
|
276 |
display: none !important;
|
277 |
}
|
278 |
+
body:not(.no-hover-css) .wcp-container .route .title:hover .move-folder-icon, body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .move-folder-icon {
|
279 |
+
display: block
|
280 |
}
|
281 |
body:not(.no-hover-css) .wcp-container .route .title:hover .ui-icon .pfolder-folder-close:before, body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .ui-icon .pfolder-folder-close:before {
|
282 |
+
content: "\e901" !important;
|
283 |
+
}
|
284 |
+
#custom-menu .route.active > h3.title .pfolder-folder-close:before {
|
285 |
+
content: "\e902";
|
286 |
}
|
287 |
.route.is-sticky > h3.title > .ui-icon > .folder-sticky-icon {
|
288 |
display: block;
|
294 |
filter: invert(100%);
|
295 |
-webkit-filter: invert(100%);
|
296 |
}
|
297 |
+
/*.route.is-sticky > h3.title > .ui-icon > i {
|
298 |
display: none;
|
299 |
+
}*/
|
300 |
.wcp-container .route .title.wcp-drop-hover img {
|
301 |
filter: invert(100%);
|
302 |
-webkit-filter: invert(100%);
|
457 |
#custom-menu .route.active .nav-icon .wcp-icon {
|
458 |
transform: rotate(0deg);
|
459 |
}
|
|
|
|
|
|
|
460 |
.route.active > .nav-icon > .folder-icon-arrow_right {
|
461 |
transform: rotate(90deg);
|
462 |
-webkit-transform: rotate(90deg);
|
482 |
}
|
483 |
.dynamic-menu {
|
484 |
position: absolute;
|
485 |
+
left: auto;
|
486 |
+
right: 5px;
|
487 |
background: #fff;
|
488 |
width: 170px;
|
489 |
padding: 0;
|
499 |
.dynamic-menu li {
|
500 |
position: relative;
|
501 |
width: 100%;
|
502 |
+
display: block !important;
|
503 |
padding: 2px 0;
|
504 |
margin: 0
|
505 |
}
|
506 |
.dynamic-menu a {
|
507 |
text-decoration: none;
|
508 |
+
color: #333333;
|
509 |
position: relative;
|
510 |
display: block;
|
511 |
padding: 5px 10px;
|
551 |
.dynamic-menu ul li span.sticky-folder-icon {
|
552 |
width: 20px;
|
553 |
}
|
554 |
+
.dynamic-menu ul li span i {
|
555 |
+
font-size: 14px;
|
556 |
+
line-height: 16px;
|
557 |
+
font-weight: normal;
|
558 |
+
}
|
559 |
.wcp-form-input {
|
560 |
padding-left: 35px;
|
561 |
box-sizing: border-box;
|
749 |
cursor: col-resize
|
750 |
}
|
751 |
div#custom-menu {
|
752 |
+
padding: 0 10px 10px;
|
753 |
background: #ffffff;
|
754 |
box-shadow: 0px 4px 21px rgba(7, 16, 28, 0.1);
|
755 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
756 |
body:not(.no-hover-css) .wcp-container .route h3:hover > span.update-inline-record, body:not(.no-hover-css) .sticky-folders li a:hover span.update-inline-record {
|
757 |
width: 18px
|
758 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
759 |
.tree-structure li {
|
760 |
display: block;
|
761 |
width: auto;
|
860 |
}
|
861 |
.mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail, .mCS-3d.mCSB_scrollTools .mCSB_draggerRail {
|
862 |
width: 2px !important;
|
863 |
+
background-color: transparent !important;
|
|
|
864 |
box-shadow: none !important
|
865 |
}
|
866 |
.mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {
|
867 |
+
width: 2px !important;
|
868 |
+
background-color: #fa166b !important;
|
869 |
+
margin: 0 0 0 4px!important;
|
870 |
+
padding: 0 !important;
|
871 |
}
|
872 |
.mCSB_outside + .mCSB_scrollTools {
|
873 |
right: -15px !important
|
1174 |
.wcp-container .folder-tooltip:not([flow])::after, .wcp-container .folder-tooltip[flow^=up]::after {
|
1175 |
bottom: calc(100% + 5px)
|
1176 |
}
|
1177 |
+
.wcp-container .folder-tooltip:not([flow])::after, .wcp-container .folder-tooltip:not([flow])::before, .wcp-container .folder-tooltip[flow^=up]::after, .wcp-container .folder-tooltip[flow^=up]::before {
|
1178 |
left: 50%;
|
1179 |
transform: translate(-50%, -.5em)
|
1180 |
}
|
1466 |
}
|
1467 |
.sticky-folders {
|
1468 |
display: none;
|
1469 |
+
padding: 0;
|
1470 |
+
margin: 10px 0 5px;
|
1471 |
+
border-top: solid 1px #E9E5E5;
|
1472 |
}
|
1473 |
.top-settings {
|
1474 |
background: #fff;
|
1495 |
}
|
1496 |
.sticky-folders > ul > li > a {
|
1497 |
display: block;
|
1498 |
+
color: #333;
|
1499 |
+
padding: 0 0 0 10px;
|
1500 |
border-radius: 3px;
|
1501 |
text-decoration: none;
|
1502 |
+
font-size: 14px;
|
1503 |
+
line-height: 30px;
|
1504 |
+
position: relative;
|
1505 |
}
|
1506 |
+
body:not(.no-hover-css) .sticky-folders ul li a:hover, .sticky-folders ul li a.active {
|
1507 |
background: #dfdfdf;
|
1508 |
border-radius: 3px;
|
1509 |
}
|
1515 |
filter: invert(100%);
|
1516 |
-webkit-filter: invert(100%);
|
1517 |
}
|
1518 |
+
.sticky-folders > ul > li > a > span {
|
1519 |
display: inline-block;
|
1520 |
vertical-align: middle;
|
1521 |
+
line-height: 30px;
|
1522 |
}
|
1523 |
+
.sticky-folders ul li a span.update-inline-record {
|
1524 |
+
line-height: 30px;
|
1525 |
+
padding: 0 0 0 5px;
|
1526 |
+
height: 30px;
|
1527 |
}
|
1528 |
+
.sticky-folders ul li a span.folder-count {
|
1529 |
+
padding: 0px 8px 0px 3px;
|
|
|
1530 |
}
|
1531 |
.sticky-wcp-custom-form a:focus {
|
1532 |
box-shadow: none;
|
1534 |
}
|
1535 |
span.folder-count {
|
1536 |
float: right;
|
1537 |
+
background: transparent;
|
1538 |
+
padding: 0;
|
|
|
1539 |
font-size: 10px;
|
1540 |
line-height: 16px;
|
1541 |
border-radius: 2px;
|
|
|
1542 |
}
|
1543 |
span.folder-count:empty {
|
1544 |
display: none;
|
1702 |
transition: 300ms ease all;
|
1703 |
left: 0%;
|
1704 |
}
|
1705 |
+
#custom-menu [class^="pfolder-"], #custom-menu [class*=" pfolder-"], .sticky-folders i {
|
1706 |
font-size: 12px;
|
1707 |
}
|
1708 |
span.create_new_folder {
|
1762 |
.hide-folders-area .ui-resizable-handle.ui-resizable-e {
|
1763 |
display: none !important;
|
1764 |
}
|
1765 |
+
.pull-right {
|
1766 |
+
float: right;
|
1767 |
+
display: block;
|
1768 |
+
line-height: 22px;
|
1769 |
+
}
|
1770 |
+
.folder-separator-2 {
|
1771 |
+
padding: 0;
|
1772 |
+
height: 1px;
|
1773 |
+
background: #E9E5E5;
|
1774 |
+
margin: 0px 0 5px 0;
|
1775 |
+
}
|
1776 |
+
.mCSB_scrollTools {
|
1777 |
+
width: 10px !important;
|
1778 |
+
}
|
1779 |
+
.mCSB_inside>.mCSB_container {
|
1780 |
+
margin-right: 0 !important;
|
1781 |
+
}
|
1782 |
+
#custom-menu .route.has-sub-tree.has-search > .nav-icon > .pfolder-arrow-down {
|
1783 |
+
transform: rotate(0);
|
1784 |
+
}
|
1785 |
@media screen and (max-width: 960px) {
|
1786 |
.wcp-content {
|
1787 |
left: 36px
|
assets/css/design.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.wcp-custom-menu{padding-left:0}.wcp-custom-menu a,.wcp-custom-menu a:focus{outline:0;box-shadow:none}.wcp-custom-menu{position:relative}.wcp-container ul{list-style:none}.wcp-container .route{position:relative;list-style-type:none;border:0;margin:0;padding:0;top:0;margin-top:0;max-height:100%!important;width:100%;border-radius:2px;z-index:-1;background:0 0}.wcp-container .route span{position:absolute;top:2px;left:0;z-index:10;width:20px;height:18px;text-indent:0;font-size:20px;background:no-repeat;text-align:center}.wcp-container .route .title{position:absolute;border:0;margin:0;padding:0;height:30px;width:200px;text-indent:28px;background:0 0;box-shadow:none;font-size:13px;line-height:26px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;overflow:hidden;font-weight:400}.wcp-container .first-title{margin-left:10px}.wcp-container .space{position:relative;list-style-type:none;border:0;margin:0 0 0 20px;padding:0 0 30px 0;width:40px;top:30px;height:100%;z-index:1}.wcp-container .first-space{margin-left:0;top:0;padding:0}i.fa-caret-right{transition:.1s;-webkit-transition:.1s;-moz-transition:.1s}li.active>span>i.fa-caret-right{transform:rotate(90deg);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg)}li.active>span>i.fa-folder:before{content:"\f07c"}.has-sub-tree>ul.ui-sortable li{display:none}.has-sub-tree.active>ul.ui-sortable>li{display:block}.nav-icon{display:none;left:-10px!important;cursor:pointer}.has-sub-tree>.nav-icon{display:block}.wcp-content{position:fixed!important;top:32px;left:160px;bottom:0;width:280px;box-sizing:border-box;z-index:1;direction:ltr;transition:all .15s linear;-webkit-transition:all .15s linear;-moz-transition:all .15s linear}html[dir=rtl] .wcp-content{left:auto;right:160px}body.folded .wcp-content{left:36px}html[dir=rtl] body.folded .wcp-content{left:auto;right:36px}body.wp-admin #wpcontent{padding-left:335px;transition:all .15s linear;-webkit-transition:all .15s linear;-moz-transition:all .15s linear}html[dir=rtl] body.wp-admin #wpcontent{padding-left:0;padding-right:320px}.wcp-container{padding:20px 20px 20px 16px}.form-title{font-size:23px;font-weight:400;margin:0;padding:0 0 10px 0;line-height:29px;min-height:36px}.form-operations{border:solid 1px #e5e5e5;border-right:none;margin-bottom:20px}.form-operations ul{margin:0;padding:0}.form-operations li{display:block;float:left;width:20%;text-align:center;background:#fff;margin:0;padding:0}.form-operations li a{display:block;padding:10px 0;border-right:solid 1px #e5e5e5;font-size:16px;color:#727272}.clearfix{clear:both}.wcp-parent-data{position:relative}.wcp-parent{position:absolute;left:-21px;font-weight:700;font-size:14px}.wcp-parent .fa{font-size:18px;margin-right:8px}.wcp-form-data{background:#fff;border:solid 1px #f1f1f1;padding:15px;display:none;margin-bottom:20px}.wcp-form-title{color:#727272;font-size:14px;text-transform:uppercase;padding:0 0 10px 0}.wcp-form-data .form-field{padding:0 0 10px 0}.wcp-form-data .form-field input,.wcp-form-data .form-field select{width:100%}button#wcp-save-folder{float:right}.wcp-form-message span{display:block;padding:5px 10px;background:#ffabab;margin-bottom:10px;color:#000;border:solid 1px #8c0000;border-radius:4px}.wcp-container .route.active-item>h3.title{background:#008ec2;color:#fff;border-radius:4px}.wcp-container .route span.ui-icon{line-height:24px;font-size:18px;cursor:move;left:5px;top:2px;height:26px}.route.active-item>span.ui-icon{background:#008ec2;color:#fff}#custom-menu.active>ul>li.route{display:block}.wcp-parent.active>i.fa-caret-right{transform:rotate(90deg);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg)}.wcp-parent.active>i.fa-folder:before{content:"\f07c"}.wcp-container .route .title .folder-sticky-icon,.wcp-container .route .title .move-folder-icon{float:right;position:relative;top:0;left:auto;width:20px;height:30px;line-height:26px;display:none}.wcp-container .route.is-sticky .title .folder-sticky-icon{display:block}span.folder-sticky-icon i{font-size:14px!important}.mCS_no_scrollbar .mCSB_container.mCS_no_scrollbar_y.mCS_y_hidden{overflow:visible}body:not(.no-hover-css) .wcp-container .route .title:hover{background:rgba(250,22,107,.08);cursor:pointer}body:not(.no-hover-css) .wcp-container .route .title:hover>.folder-sticky-icon,body:not(.no-hover-css) .wcp-container .route .title:hover>.star-icon{display:none!important}body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .move-folder-icon,body:not(.no-hover-css) .wcp-container .route .title:hover .move-folder-icon{display:block}body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .ui-icon .pfolder-folder-close:before,body:not(.no-hover-css) .wcp-container .route .title:hover .ui-icon .pfolder-folder-close:before{content:"\e901"!important}#custom-menu .route.active>h3.title .pfolder-folder-close:before{content:"\e902"}.route.is-sticky>h3.title>.ui-icon>.folder-sticky-icon{display:block;width:100%;height:auto;margin:3px auto 0}.route.is-sticky.active-item>h3.title>.ui-icon>.folder-sticky-icon{filter:invert(100%);-webkit-filter:invert(100%)}.wcp-container .route .title.wcp-drop-hover img{filter:invert(100%);-webkit-filter:invert(100%)}.plugin-button{float:right}.plugin-button.d-block{float:none}.plugin-title{display:inline-block;vertical-align:middle}.add-new-folder{text-decoration:none;display:inline-block;font-size:14px;padding:4px 10px 4px 4px;background:#f51366;color:#fff;border:solid 1px #f51366;border-radius:4px;line-height:24px;position:relative}.add-new-folder:focus,.add-new-folder:hover{color:#fff}.add-new-folder:hover:after{content:"";width:100%;height:100%;background:rgba(0,0,0,.1);position:absolute;top:0;left:0}.add-new-folder span{display:block;float:left;line-height:24px;font-size:14px;margin-right:5px}.add-new-folder span.folder-icon-create_new_folder{font-size:20px}.form-options{background:#fff;padding:5px;margin:0 0;border-radius:4px;box-shadow:0 4px 21px rgba(7,16,28,.1)}.form-options .form-options{padding:0;background:0 0;box-shadow:none}.form-options ul{margin:0;padding:0}.form-options>ul>li{display:inline-block;margin:0 2px 0 0;vertical-align:top}.form-options>ul>li.last{margin:0}.form-options>ul>li>a{display:inline-block;text-decoration:none;padding:5px 5px;color:#000;vertical-align:middle;margin:0 0 5px 0;background:#f1f1f1;border-radius:4px}.form-options>ul>li.last>a{padding:3px}a#expand-collapse-list.all-open span{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.form-options>ul>li>a:hover{background:#404040;color:#fff}.form-options>ul>li>a:hover span.icon{color:#fff}.form-options>ul>li>a.expand-collapse{width:14px;text-align:center}.form-options a.expand-collapse span.icon{font-size:10px}.form-options span.icon{font-size:12px;display:inline-block;vertical-align:baseline;color:#a4c0d2}.un-categorised-items{border-radius:3px}.header-posts a,.un-categorised-items a{color:#444;padding:7px;display:block;text-decoration:none;font-size:14px;border-radius:4px;line-height:18px}.header-posts a:hover,.un-categorised-items.active-item,.un-categorised-items:hover{background:rgba(250,22,107,.08);border-radius:4px}.header-posts a.active-item,.un-categorised-items.active-item{background:#008ec2!important;color:#fff!important}.un-categorised-items.active-item a{color:#fff!important}.header-posts a.active-item span.total-count,.un-categorised-items.active-item a span{color:#fff!important}span.total-count{float:right;font-size:12px;line-height:16px}.wcp-icon{display:inline-block;font-size:16px;vertical-align:top;margin-right:3px}#custom-menu .wcp-icon{font-size:16px!important;line-height:24px}#custom-menu .route .nav-icon .wcp-icon{font-size:9px!important;color:#fa166b;font-weight:700;transform:rotate(-90deg);transition:all .25s linear}#custom-menu .route.active .nav-icon .wcp-icon{transform:rotate(0)}.route.active>.nav-icon>.folder-icon-arrow_right{transform:rotate(90deg);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg)}.route.active>.ui-icon>.folder-icon-folder:before{content:"\e90c"}.wcp-container .route span.total-count{position:relative;font-size:10px;float:right;text-align:center;width:auto;display:block;margin:4px 8px 3px 3px;color:#23282d!important;line-height:16px;height:16px}.wcp-container .route.active-item>h3.title span.total-count{color:#fff!important}.dynamic-menu{position:absolute;left:50px;background:#fff;width:170px;padding:0;z-index:101;-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.25);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.25);box-shadow:0 0 5px 0 rgba(0,0,0,.25)}.sticky-folders .dynamic-menu{left:auto;right:50px}.dynamic-menu li{position:relative;width:100%;display:inline-block!important;padding:2px 0;margin:0}.dynamic-menu a{text-decoration:none;color:#848484;position:relative;display:block;padding:5px 10px;line-height:18px;white-space:nowrap}.dynamic-menu ul>li>a>span,.dynamic-menu ul>li>a>span span{position:relative!important;display:inline-block;vertical-align:middle;margin-right:5px;top:auto!important;width:20px!important;height:20px!important;line-height:14px}#custom-menu .dynamic-menu ul>li>a .sticky-pin{line-height:20px}#custom-menu .dynamic-menu ul>li>a .sticky-pin i{font-size:16px!important}.dynamic-menu ul>li>a>span span{top:auto;height:auto;width:auto;margin:0;left:auto;vertical-align:baseline;display:inline}.dynamic-menu li.new-folder{border-bottom:solid 1px #d8d8d8}.dynamic-menu a.active,.dynamic-menu a:hover{background:#efefef;color:#000}.dynamic-menu ul li span{font-size:20px;vertical-align:middle}.dynamic-menu ul li span.sticky-folder-icon{width:20px}.wcp-form-input{padding-left:35px;box-sizing:border-box;position:relative}.wcp-form-input input{width:100%}.wcp-form-btn{padding:4px 0 4px 2px}.wcp-form-input:before{content:"\e90d";font-family:folder-icon!important;speak:none;position:absolute;left:0;font-size:28px;top:5px}.add-new-folder-btn{margin-right:5px!important}.form-loader{width:100%;height:5px;margin:0 0 10px}.form-loader-count{width:0;height:5px;background:url(../images/form-loader.png);transition:all 2.5s linear;-webkit-transition:all 2s linear;-moz-transition:all 2.5s linear}.route.is-high>.ui-icon>i:before{content:"\e900"!important}.route.is-high.active>.ui-icon>i:before{content:"\e90c"!important;z-index:11;color:#444;font-size:20px}.route.is-high.active>.ui-icon>i:after{content:"\e907";margin-left:-1.2em;color:#444;font-size:11px;top:1px;position:absolute}.route.is-high.active.active-item>.ui-icon>i:after,.route.is-high.active.active-item>.ui-icon>i:before{color:#fff}li.active-menu{z-index:2!important}.wp-list-table th{width:auto!important}.wp-list-table th.column-title{width:35%!important}.fixed .column-author,.fixed .column-date,.fixed .column-format,.fixed .column-links,.fixed .column-parent,.fixed .column-posts{width:10%!important}.wp-list-table #wcp_move{width:20px!important}td.wcp_move.column-wcp_move{vertical-align:middle}.wp-list-table tr td .wcp-move-file{vertical-align:middle;opacity:0}.wp-list-table td.wcp_move.column-wcp_move.wcp-draggable,.wp-list-table tr:hover td .wcp-move-file{opacity:1}.wcp-drop-hover{background:#fa166b!important;z-index:2!important;color:#fff!important}.wcp-drop-hover i{color:#fff!important}.ui-draggable-dragging{z-index:1051!important}.wcp-hover-list{background:#fa166b!important;color:#fff;position:relative}.wcp-hover-list a{color:#fff}.wcp-hover-list span.total-count{color:#000}span.wcp-item{display:none}.wcp-move-file{cursor:move}.wcp-drop-hover-list a.folder-view{background:#008ec2;color:#fff;border:solid 1px #fff;position:relative}.wcp-drop-hover-list a.folder-view:before{width:100%;height:100%;content:"";position:absolute;top:-2px;left:-2px;border:solid 1px #008ec2;padding:1px;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px}.ui-draggable-dragging.wcp-move-file{z-index:5001;display:inline-block;border:solid 2px #0073aa;padding:5px 10px;border-radius:5px;background:#e4f6ff;position:fixed!important;max-width:230px;overflow:hidden;width:auto!important}.ui-draggable-dragging.wcp-move-file span{display:block;float:left}.ui-draggable-dragging.wcp-move-file span.wcp-move{margin-right:5px;display:block;float:left}.wcp-container .route span.title-text{position:relative;top:auto;left:auto;display:inline-block;font-size:16px;line-height:30px;height:30px;width:calc(100% - 100px);overflow:hidden;white-space:nowrap;text-align:left}.ui-resizable-handle.ui-resizable-e{position:absolute;top:0;height:100%;height:100vh;width:1px;right:0;border-right:1px solid #ccc;cursor:col-resize}.ui-resizable-handle.ui-resizable-e:before,.ui-resizable-handle.ui-resizable-w:before{content:"";top:25%;width:3px;height:30px;position:absolute;border-left:solid 1px #fa166b;border-right:solid 1px #fa166b;left:-1px}.ui-resizable-handle.ui-resizable-w{position:absolute;top:0;height:100%;height:100vh;width:1px;left:0;border-right:1px solid #ccc;cursor:col-resize}div#custom-menu{padding:0 10px 10px;background:#fff;box-shadow:0 4px 21px rgba(7,16,28,.1)}.sticky-folders li a span.star-icon,.wcp-container .route span.star-icon{position:relative;top:2px;left:auto;float:right;font-family:folder-icon!important;speak:none;color:#ffc90e;display:none;font-size:14px}.sticky-folders li a span.update-inline-record,.wcp-container .route span.update-inline-record{position:relative;left:auto;top:0;float:right;width:0;height:30px;font-size:16px;overflow:hidden;transition:all .25s linear;-webkit-transition:all .25s linear;-moz-transition:all .25s linear;line-height:30px}body:not(.no-hover-css) .sticky-folders li a:hover span.update-inline-record,body:not(.no-hover-css) .wcp-container .route h3:hover>span.update-inline-record{width:18px}.sticky-folders li.is-high a span.star-icon,.wcp-container .route.is-high>h3>span.star-icon{display:block}.tree-structure li{display:block;width:auto;float:left;margin:0;padding:0}.tree-structure .folder-item{padding:4px;position:relative}.tree-structure .folder-view{display:block;border:none;color:#404040;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;position:relative;cursor:pointer;background:#f1f1f1;font-size:14px;line-height:16px}.tree-structure .folder-view span.item-name{display:block;padding:8px 15px 8px 30px;position:relative;width:100%;overflow:hidden;height:32px;font-size:14px;box-sizing:border-box}.folder-view span.item-name:before{content:"\e906";font-family:premio-folder!important;position:absolute;left:8px;font-size:16px;color:#a4c0d2}.folder-view.is-high span.item-name:before{content:"\e900"}.folder-view.is-post span.item-name:before{content:"\e901"}.tree-structure span.folder-option{position:absolute;right:0;font-family:folder-icon!important;top:0;font-size:20px;line-height:38px;z-index:1;cursor:pointer;display:none}.tree-structure .folder-view:hover span.folder-option{display:block}.tree-structure span.folder-option:hover{color:#f51366}.tree-structure span.folder-option:after{content:"\e90a"}.tree-structure li{position:relative}.tree-structure{margin-left:-8px;margin-right:-8px}.tree-structure .folder-view span.folder-title{width:100%;display:block}.swal2-popup .swal2-title{line-height:36px}.attachments-browser.ui-draggable-dragging .media-sidebar,.attachments-browser.ui-draggable-dragging .media-toolbar,.attachments-browser.ui-draggable-dragging .uploader-inline,.attachments-browser.ui-draggable-dragging ul.attachments{display:none}.attachments.ui-sortable.ui-draggable-dragging{z-index:5000}.selected-items{background:#0073aa;color:#fff;padding:10px 20px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;margin-top:0;cursor:none;font-size:12px}.media-frame,.media-frame .attachments-browser,.media-frame-content{overflow:inherit}.mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-3d.mCSB_scrollTools .mCSB_draggerRail{width:2px!important;background-color:transparent!important;box-shadow:none!important}.mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{width:2px!important;background-color:#fa166b!important;margin:0 0 0 4px!important;padding:0!important}.mCSB_outside+.mCSB_scrollTools{right:-15px!important}body.upload-php.eml-grid #wpbody{position:relative!important;top:0!important;bottom:auto!important;left:auto!important;right:auto!important;height:auto}#footer-thankyou{display:none}span.upgrade-message{padding:0;background:#fff;display:inline-block;font-size:12px;color:#000}span.upgrade-message a.pink,span.upgrade-message span.pink{color:#ff5983;text-decoration:none;font-weight:700}.media-toolbar.sticky-media{position:fixed;top:32px;right:18px!important;left:auto}.media-position{width:1px;height:1px}.media-frame.mode-grid .media-toolbar{margin:0!important}.button-disabled{cursor:no-drop;pointer-events:none}.wcp-hide-show-buttons{position:absolute;top:25px;right:-20px;z-index:10001}html[dir=rtl] .wcp-hide-show-buttons{left:-20px;right:auto}.wcp-hide-show-buttons .toggle-buttons{background:#f51366;color:#fff;display:inline-block;margin:0;padding:0;float:left;-webkit-border-top-right-radius:50%;-webkit-border-bottom-right-radius:50%;-moz-border-radius-topright:50%;-moz-border-radius-bottomright:50%;border-top-right-radius:50%;border-bottom-right-radius:50%;display:none;width:20px;height:20px;cursor:pointer;position:relative}.wcp-hide-show-buttons:hover .toggle-buttons:after{content:"";width:100%;height:100%;background:0 0;position:absolute;top:0;left:0;-webkit-border-top-right-radius:50%;-webkit-border-bottom-right-radius:50%;-moz-border-radius-topright:50%;-moz-border-radius-bottomright:50%;border-top-right-radius:50%;border-bottom-right-radius:50%}html[dir=rtl] .wcp-hide-show-buttons .toggle-buttons{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;-webkit-border-top-left-radius:50%;-webkit-border-bottom-left-radius:50%;-moz-border-radius-top-left:50%;-moz-border-radius-bottom-left:50%;border-top-left-radius:50%;border-bottom-left-radius:50%}html[dir=rtl] .wcp-hide-show-buttons .toggle-buttons span{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.hide-folders-area .wcp-content{width:0!important}.hide-folders-area .wcp-container{display:none}.wcp-hide-show-buttons .toggle-buttons.active{display:block}#wcp-content.no-transition .wcp-container{display:none}button.button.organize-button{vertical-align:middle;text-decoration:none;display:inline-block;font-size:14px;padding:4px 10px;background:#f51366;color:#fff;border:solid 1px #f51366;border-radius:3px;line-height:14px;-webkit-box-shadow:0 3px 5px -3px #333;-moz-box-shadow:0 3px 5px -3px #333;box-shadow:0 3px 5px -3px #333;position:relative}button.button.organize-button:focus,button.button.organize-button:hover{color:#fff}button.button.organize-button:hover:after{content:"";width:100%;height:100%;background:rgba(0,0,0,.1);position:absolute;top:0;left:0}.tree-structure-content ul{margin:0;padding:0}.tree-structure-content{padding:5px 10px;background:#fff;margin:10px 0 15px;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;border:solid 1px #ccc}.tree-structure-content .tree-structure{height:40px;overflow:hidden;transition:.1s;-webkit-transition:.1s;-moz-transition:.1s}.tree-structure-content.active .tree-structure{height:auto}.folders-toggle-button{height:15px;text-align:center;position:relative}.folders-toggle-button span{background:#f51366;color:#fff;height:20px;width:30px;text-align:center;display:block;margin:0 auto;position:absolute;left:0;right:0;bottom:-10px;cursor:pointer;font-family:dashicons;font-size:20px;line-height:20px}.folders-toggle-button span:after{content:"\f347"}.tree-structure-content.active .folders-toggle-button span:after{content:"\f343"}span.media-info-message{vertical-align:middle;line-height:20px;font-weight:700;color:#f51366;padding:0 0 10px 0;display:none!important}span.media-info-message.active{display:block!important}.folder-popup-form{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.5);top:0;left:0;z-index:10001;display:none}.folder-popup-form.disabled{pointer-events:none}.popup-form-content{background:#fff;min-height:100px;width:400px;text-align:center;margin:0 auto;position:absolute;left:0;right:0;top:50%;transform:translate(0,-50%);-webkit-transform:translate(0,-50%);-moz-transform:translate(0,-50%);-o-transform:translate(0,-50%);-ms-transform:translate(0,-50%);padding:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;color:#484848}.folder-form-buttons a,.folder-form-buttons button{display:inline-flex;padding:0;text-decoration:none;margin:10px 3px;border-radius:4px;border:solid 1px #1da1f4;line-height:34px;font-weight:700;font-size:14px;box-sizing:border-box;height:36px;cursor:pointer;flex:1;justify-content:center}.folder-form-buttons a span,.folder-form-buttons button span{-webkit-animation:fa-spin .75s infinite linear;animation:fa-spin .75s infinite linear;padding:7px}.wcp-container .folder-tooltip{position:relative}.wcp-container .folder-tooltip::after,.wcp-container .folder-tooltip::before{text-transform:none;font-size:.9em;line-height:1;user-select:none;pointer-events:none;position:absolute;display:none;opacity:0}.wcp-container .folder-tooltip::before{content:'';border:5px solid transparent;z-index:1001}.wcp-container .folder-tooltip::after{content:attr(data-folder-tooltip);font-family:Helvetica,sans-serif;text-align:center;min-width:3em;max-width:21em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:1ch 1.5ch;border-radius:.3ch;box-shadow:0 1em 2em -.5em rgba(0,0,0,.35);background:#333;color:#fff;z-index:1000}.wcp-container .folder-tooltip:hover::after,.wcp-container .folder-tooltip:hover::before{display:block;opacity:1}.wcp-container .folder-tooltip:not([flow])::before,.wcp-container .folder-tooltip[flow^=up]::before{bottom:100%;border-bottom-width:0;border-top-color:#333}.wcp-container .folder-tooltip:not([flow])::after,.wcp-container .folder-tooltip[flow^=up]::after{bottom:calc(100% + 5px)}.wcp-container .folder-tooltip:not([flow])::after,.wcp-container .folder-tooltip:not([flow])::before,.wcp-container .folder-tooltip[flow^=up]::after,.wcp-container .folder-tooltip[flow^=up]::before{left:50%;transform:translate(-50%,-.5em)}.wp-core-ui .button-primary.select-all-item-btn{margin:11px 11px 11px 0;display:none!important}.wp-core-ui .button-primary.select-all-item-btn.active{display:inline-block!important}.form-options>ul>li.last.folder-checkbox{padding:5px 0 0}#custom-menu input.checkbox{display:none}#custom-menu.show-folder-checkbox input.checkbox{display:block;margin:5px 0 0 0}#custom-menu.show-folder-checkbox h3.title>.ui-icon>i,#custom-menu.show-folder-checkbox h3.title>.ui-icon>img{display:none!important}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.folder-form-buttons a:focus,.folder-form-buttons a:hover,.folder-form-buttons button:focus,.folder-form-buttons button:hover{color:#fff;outline:0}.folder-form-buttons a:focus{outline:0;outline:0}.form-cancel-btn,a.form-cancel-btn:hover{background-color:#fff;color:#3085d6;outline:0}.form-submit-btn{background-color:#3085d6;color:#fff;outline:0}.add-update-folder-title{display:block;position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;text-align:center;text-transform:none;word-wrap:break-word;font-weight:700;font-size:22px;line-height:26px}.folder-form-message{font-size:15px;line-height:18px;color:#484848;padding:25px 70px}.folder-form-errors{margin:0 0 10px 0;padding:8px 0;background:#ffe4e4;color:#a20000;display:none}.folder-form-errors.active{display:block}span.folder-loader-ajax{margin:0;line-height:30px;display:none;vertical-align:middle}.folder-loader-ajax.active{display:inline-block}@-webkit-keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes drawCircle{0%{stroke-dashoffset:151px}100%{stroke-dashoffset:0}}@keyframes drawCircle{0%{stroke-dashoffset:151px}100%{stroke-dashoffset:0}}@-webkit-keyframes drawCheck{0%{stroke-dashoffset:36px}100%{stroke-dashoffset:0}}@keyframes drawCheck{0%{stroke-dashoffset:36px}100%{stroke-dashoffset:0}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}#successAnimationCircle{stroke-dasharray:151px 151px;stroke:#2ce0a7}#successAnimationCheck{stroke-dasharray:36px 36px;stroke:#2ce0a7}#successAnimationResult{fill:#2ce0a7;opacity:0}svg#successAnimation{width:30px;height:34px;padding:0;display:none;float:left}#successAnimation.active{display:inline-block}.folder-loader-ajax img{display:none}.folder-loader-ajax img.active{display:inline-block}#successAnimation.animated{-webkit-animation:1s ease-out 0s 1 both scaleAnimation;animation:1s ease-out 0s 1 both scaleAnimation}#successAnimation.animated #successAnimationCircle{-webkit-animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCircle,.3s linear .9s 1 both fadeOut;animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCircle,.3s linear .9s 1 both fadeOut}#successAnimation.animated #successAnimationCheck{-webkit-animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCheck,.3s linear .9s 1 both fadeOut;animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCheck,.3s linear .9s 1 both fadeOut}#successAnimation.animated #successAnimationResult{-webkit-animation:.3s linear .9s both fadeIn;animation:.3s linear .9s both fadeIn}.mCSB_scrollTools a+.mCSB_draggerContainer{margin:10px 0!important}.popup-folder-title{font-weight:700;font-size:24px;padding:0 0 20px 0}.select-box{padding:20px 0 10px 0}.select-box select{width:100%;max-width:300px}.actions #media_folder,select.media-select-folder{width:132px}select#media-attachment-taxonomy-filter{width:132px}.custom-media-select{float:right;padding:10px 0 0 0;display:none}.custom-media-select.active{display:block}.folder-progress{background:#b4b9be;border-radius:4px;margin:5px 0 0 0;position:relative}.folder-meter{height:20px;position:relative;background:#f1f1f1;padding:0;width:0%;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear}.folder-meter>span{display:block;height:100%;-webkit-box-shadow:inset 0 2px 9px rgba(255,255,255,.3),inset 0 -2px 6px rgba(0,0,0,.4);-moz-box-shadow:inset 0 2px 9px rgba(255,255,255,.3),inset 0 -2px 6px rgba(0,0,0,.4);box-shadow:inset 0 2px 9px rgba(255,255,255,.3),inset 0 -2px 6px rgba(0,0,0,.4);position:relative;overflow:hidden;border-radius:4px}.folder-animate>span>span,.folder-meter>span:after,.folder-progress:after{content:"";position:absolute;border-radius:4px;top:0;left:0;bottom:0;right:0;background-image:-webkit-gradient(linear,0 0,100% 100%,color-stop(.25,rgba(255,255,255,.2)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.2)),color-stop(.75,rgba(255,255,255,.2)),color-stop(.75,transparent),to(transparent));background-image:-moz-linear-gradient(-45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);z-index:1;-webkit-background-size:50px 50px;-moz-background-size:50px 50px;-webkit-animation:move 2s linear infinite;overflow:hidden}.folder-animate>span:after{display:none}@-webkit-keyframes move{0%{background-position:0 0}100%{background-position:50px 50px}}.media-folder-loader{padding:10px 0 15px;display:none}.media-folder-loader>span{font-weight:700}.sticky-folders{display:none;padding:0;margin:10px 0 5px;border-top:solid 1px #e9e5e5}.top-settings{background:#fff;padding:10px 10px 5px;-webkit-border-top-left-radius:4px;-webkit-border-top-right-radius:4px;-moz-border-radius-topleft:4px;-moz-border-radius-topright:4px;border-top-left-radius:4px;border-top-right-radius:4px;box-shadow:0 4px 21px rgba(7,16,28,.1)}.sticky-folders.active{display:block}.sticky-folders ul{margin:0;padding:0}.sticky-folders>ul>li{display:block;margin:0;padding:0}.sticky-folders>ul>li>a{display:block;color:#444;padding:0 0 0 10px;border-radius:3px;text-decoration:none;font-size:14px;line-height:30px}.sticky-folders ul li a.active,.sticky-folders ul li a:hover{background:#dfdfdf;border-radius:3px}.sticky-folders ul li a.active-item{background-color:#008ec2!important;color:#fff}.sticky-folders ul li a.active-item img{filter:invert(100%);-webkit-filter:invert(100%)}.sticky-folders>ul>li>a>span{display:inline-block;vertical-align:middle;line-height:30px}.sticky-folders ul li a span.update-inline-record{line-height:30px;padding:0 0 0 5px;height:30px}.sticky-folders ul li a span.folder-count{padding:0 8px 0 3px}.sticky-wcp-custom-form a:focus{box-shadow:none;outline:0}span.folder-count{float:right;background:0 0;padding:0;font-size:10px;line-height:16px;border-radius:2px;color:#444!important}span.folder-count:empty{display:none}.sticky-title{font-size:16px;font-weight:700;padding:7px}.sticky-title img{display:inline-block;vertical-align:middle;height:20px;width:20px}.sticky-folder-icon img{width:100%;filter:invert(50%);-webkit-filter:invert(50%)}.dynamic-menu .sticky-folder:hover img{filter:invert(0);-webkit-filter:invert(0)}.form-options>ul>li.last>a.sort-folder-order{width:28px;padding:5px;text-align:center;display:inline-block;box-sizing:border-box}.sort-folder-order svg{width:100%;height:100%;fill:#000}.sort-folder-order:hover svg{fill:#fff}.folder-order{position:relative}.folder-sort-menu{position:absolute;right:0;width:120px;z-index:101;background:#fff;-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.25);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.25);box-shadow:0 0 5px 0 rgba(0,0,0,.25);display:none}.folder-order.active .folder-sort-menu{display:block}.folder-order.active .sort-folder-order{background:#404040;color:#fff}.folder-order.active .sort-folder-order svg{fill:#fff}.folder-sort-menu li{display:block;margin:0;padding:0;background:0 0}.folder-sort-menu li a{display:block;margin:0;padding:3px 5px;background:0 0;color:#848484;text-decoration:none;font-size:14px}.folder-sort-menu li a.active,.folder-sort-menu li a:hover{background:#efefef;color:#000}.dynamic-menu.bottom-fix{bottom:0}.folder-form-buttons{display:flex}.folder-group{position:relative;margin:45px auto 15px;padding:0 2px}.folder-grouptextarea{resize:none}.folder-group input,.folder-group textarea{background:0 0;font-size:14px;padding:0 0 0 15px;display:block;width:100%;border-radius:4px;border:1px solid #484848;height:34px;line-height:34px;color:#484848}.folder-group input:focus,.folder-group textarea:focus{outline:0}.folder-group input:focus~label,.folder-group input:valid~label,.folder-group textarea:focus~label,.folder-group textarea:valid~label{top:-9px;background:#fff;padding:0 5px;font-weight:400;font-size:12px;line-height:14px;color:#aeaeae}.folder-group input:focus~.bar:before,.folder-group textarea:focus~.bar:before{width:320px}.folder-group input[type=password]{letter-spacing:.3em}.folder-group label{font-size:14px;font-weight:500;position:absolute;pointer-events:none;left:20px;top:10px;-webkit-transition:.3s ease all;transition:.3s ease all;color:#484848}.folder-group .folder-bar{position:relative;display:block;width:320px}.folder-group .folder-bar:before{content:'';height:2px;width:0;bottom:0;position:absolute;background:#2196f3;-webkit-transition:.3s ease all;transition:.3s ease all;left:0}#custom-menu [class*=" pfolder-"],#custom-menu [class^=pfolder-],.sticky-folders i{font-size:12px}span.create_new_folder{width:26px;height:26px;line-height:26px;font-size:14px;background:rgba(255,255,255,.4);backdrop-filter:blur(16px);border-radius:4px;text-align:center;margin:0 15px 0 0}.folder-search-form{padding:0 0 10px 0;position:relative}.folder-search-form input{background:#fff;border:1px solid #dbdbdb;box-sizing:border-box;border-radius:4px;height:32px;line-height:32px;box-sizing:border-box;padding:0 5px;width:100%;outline:0;box-shadow:none!important}.folder-search-form span{position:absolute;color:#aeaeae;right:0;top:0;height:32px;line-height:32px;width:32px;text-align:center}.folder-separator{padding:0 10px;height:1px;background:#e9e5e5;margin:0 0 10px 0}#custom-menu.has-filter li.route{display:none!important}#custom-menu.has-filter li.route.has-search{display:block!important}#custom-menu.has-filter h3 span.title-text.has-search-text{font-weight:700}.hide-folders-area .ui-resizable-handle.ui-resizable-e{display:none!important}.pull-right{float:right;display:block;line-height:22px}.folder-separator-2{padding:0 10px;height:1px;background:#e9e5e5;margin:10px 0 0 0}.mCSB_scrollTools{width:10px!important}.mCSB_inside>.mCSB_container{margin-right:0!important}#custom-menu .route.has-sub-tree.has-search>.nav-icon>.pfolder-arrow-down{transform:rotate(0)}@media screen and (max-width:960px){.wcp-content{left:36px}html[dir=rtl] .wcp-content{right:36px;left:auto}}@media screen and (max-width:780px){.wcp-content{left:0}html[dir=rtl] .wcp-content{right:0}}@media screen and (max-width:640px){.wcp-content{left:0;position:relative!important;width:100%!important;padding-bottom:100px;top:0;right:0;display:block}.ui-resizable-handle.ui-resizable-e{display:none!important}.hide-folders-area .wcp-container{display:block}.wcp-hide-show-buttons{display:none}.hide-folders-area .wcp-content{width:100%!important}body.wp-admin #wpcontent{padding:0!important}#wpbody-content{padding-bottom:30px}}
|
1 |
+
.wcp-custom-menu{padding-left:0}.wcp-custom-menu a,.wcp-custom-menu a:focus{outline:0;box-shadow:none}.wcp-custom-menu{position:relative}.wcp-container ul{list-style:none}.wcp-container .route{position:relative;list-style-type:none;border:0;margin:0;padding:0;top:0;margin-top:0;max-height:100%!important;width:100%;border-radius:2px;z-index:-1;background:0 0}.wcp-container .route span{position:absolute;top:2px;left:0;z-index:10;width:20px;height:18px;text-indent:0;font-size:20px;background:no-repeat;text-align:center}.wcp-container .route .title{position:absolute;border:0;margin:0;padding:0;height:30px;width:200px;text-indent:28px;background:0 0;box-shadow:none;font-size:13px;line-height:26px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;overflow:hidden;font-weight:400}.wcp-container .first-title{margin-left:10px}.wcp-container .space{position:relative;list-style-type:none;border:0;margin:0 0 0 20px;padding:0 0 30px 0;width:40px;top:30px;height:100%;z-index:1}.wcp-container .first-space{margin-left:0;top:0;padding:0}i.fa-caret-right{transition:.1s;-webkit-transition:.1s;-moz-transition:.1s}li.active>span>i.fa-caret-right{transform:rotate(90deg);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg)}li.active>span>i.fa-folder:before{content:"\f07c"}.has-sub-tree>ul.ui-sortable li{display:none}.has-sub-tree.active>ul.ui-sortable>li{display:block}.nav-icon{display:none;left:-10px!important;cursor:pointer}.has-sub-tree>.nav-icon{display:block}.wcp-content{position:fixed!important;top:32px;left:160px;bottom:0;width:280px;box-sizing:border-box;z-index:1;direction:ltr;transition:all .15s linear;-webkit-transition:all .15s linear;-moz-transition:all .15s linear}html[dir=rtl] .wcp-content{left:auto;right:160px}body.folded .wcp-content{left:36px}html[dir=rtl] body.folded .wcp-content{left:auto;right:36px}body.wp-admin #wpcontent{padding-left:335px;transition:all .15s linear;-webkit-transition:all .15s linear;-moz-transition:all .15s linear}html[dir=rtl] body.wp-admin #wpcontent{padding-left:0;padding-right:320px}.wcp-container{padding:20px 20px 20px 16px}.form-title{font-size:23px;font-weight:400;margin:0;padding:0 0 10px 0;line-height:29px;min-height:36px}.form-operations{border:solid 1px #e5e5e5;border-right:none;margin-bottom:20px}.form-operations ul{margin:0;padding:0}.form-operations li{display:block;float:left;width:20%;text-align:center;background:#fff;margin:0;padding:0}.form-operations li a{display:block;padding:10px 0;border-right:solid 1px #e5e5e5;font-size:16px;color:#727272}.clearfix{clear:both}.wcp-parent-data{position:relative}.wcp-parent{position:absolute;left:-21px;font-weight:700;font-size:14px}.wcp-parent .fa{font-size:18px;margin-right:8px}.wcp-form-data{background:#fff;border:solid 1px #f1f1f1;padding:15px;display:none;margin-bottom:20px}.wcp-form-title{color:#727272;font-size:14px;text-transform:uppercase;padding:0 0 10px 0}.wcp-form-data .form-field{padding:0 0 10px 0}.wcp-form-data .form-field input,.wcp-form-data .form-field select{width:100%}button#wcp-save-folder{float:right}.wcp-form-message span{display:block;padding:5px 10px;background:#ffabab;margin-bottom:10px;color:#000;border:solid 1px #8c0000;border-radius:4px}.wcp-container .route.active-item>h3.title{background:#008ec2;color:#fff;border-radius:4px}.wcp-container .route span.ui-icon{line-height:24px;font-size:18px;cursor:move;left:5px;top:2px;height:26px}.route.active-item>span.ui-icon{background:#008ec2;color:#fff}#custom-menu.active>ul>li.route{display:block}.wcp-parent.active>i.fa-caret-right{transform:rotate(90deg);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg)}.wcp-parent.active>i.fa-folder:before{content:"\f07c"}.wcp-container .route .title .folder-sticky-icon,.wcp-container .route .title .move-folder-icon{float:right;position:relative;top:0;left:auto;width:20px;height:30px;line-height:26px;display:none}.wcp-container .route.is-sticky .title .folder-sticky-icon{display:block}span.folder-sticky-icon i{font-size:14px!important}.mCS_no_scrollbar .mCSB_container.mCS_no_scrollbar_y.mCS_y_hidden{overflow:visible}body:not(.no-hover-css) .wcp-container .route .title:hover{background:rgba(250,22,107,.08);cursor:pointer}body:not(.no-hover-css) .wcp-container .route .title:hover>.folder-sticky-icon,body:not(.no-hover-css) .wcp-container .route .title:hover>.star-icon{display:none!important}body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .move-folder-icon,body:not(.no-hover-css) .wcp-container .route .title:hover .move-folder-icon{display:block}body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .ui-icon .pfolder-folder-close:before,body:not(.no-hover-css) .wcp-container .route .title:hover .ui-icon .pfolder-folder-close:before{content:"\e901"!important}#custom-menu .route.active>h3.title .pfolder-folder-close:before{content:"\e902"}.route.is-sticky>h3.title>.ui-icon>.folder-sticky-icon{display:block;width:100%;height:auto;margin:3px auto 0}.route.is-sticky.active-item>h3.title>.ui-icon>.folder-sticky-icon{filter:invert(100%);-webkit-filter:invert(100%)}.wcp-container .route .title.wcp-drop-hover img{filter:invert(100%);-webkit-filter:invert(100%)}.plugin-button{float:right}.plugin-button.d-block{float:none}.plugin-title{display:inline-block;vertical-align:middle}.add-new-folder{text-decoration:none;display:inline-block;font-size:14px;padding:4px 10px 4px 4px;background:#f51366;color:#fff;border:solid 1px #f51366;border-radius:4px;line-height:24px;position:relative}.add-new-folder:focus,.add-new-folder:hover{color:#fff}.add-new-folder:hover:after{content:"";width:100%;height:100%;background:rgba(0,0,0,.1);position:absolute;top:0;left:0}.add-new-folder span{display:block;float:left;line-height:24px;font-size:14px;margin-right:5px}.add-new-folder span.folder-icon-create_new_folder{font-size:20px}.form-options{background:#fff;padding:5px;margin:0 0;border-radius:4px;box-shadow:0 4px 21px rgba(7,16,28,.1)}.form-options .form-options{padding:0;background:0 0;box-shadow:none}.form-options ul{margin:0;padding:0}.form-options>ul>li{display:inline-block;margin:0 2px 0 0;vertical-align:top}.form-options>ul>li.last{margin:0}.form-options>ul>li>a{display:inline-block;text-decoration:none;padding:5px 5px;color:#000;vertical-align:middle;margin:0 0 5px 0;background:#f1f1f1;border-radius:4px}.form-options>ul>li.last>a{padding:3px}a#expand-collapse-list.all-open span{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.form-options>ul>li>a:hover{background:#404040;color:#fff}.form-options>ul>li>a:hover span.icon{color:#fff}.form-options>ul>li>a.expand-collapse{width:14px;text-align:center}.form-options a.expand-collapse span.icon{font-size:10px}.form-options span.icon{font-size:12px;display:inline-block;vertical-align:baseline;color:#a4c0d2}.un-categorised-items{border-radius:3px}.header-posts a,.un-categorised-items a{color:#444;padding:7px;display:block;text-decoration:none;font-size:14px;border-radius:4px;line-height:18px}.header-posts a:hover,.un-categorised-items.active-item,.un-categorised-items:hover{background:rgba(250,22,107,.08);border-radius:4px}.header-posts a.active-item,.un-categorised-items.active-item{background:#008ec2!important;color:#fff!important}.un-categorised-items.active-item a{color:#fff!important}.header-posts a.active-item span.total-count,.un-categorised-items.active-item a span{color:#fff!important}span.total-count{float:right;font-size:12px;line-height:16px}.wcp-icon{display:inline-block;font-size:16px;vertical-align:top;margin-right:3px}#custom-menu .wcp-icon{font-size:16px!important;line-height:24px}#custom-menu .route .nav-icon .wcp-icon{font-size:9px!important;color:#fa166b;font-weight:700;transform:rotate(-90deg);transition:all .25s linear}#custom-menu .route.active .nav-icon .wcp-icon{transform:rotate(0)}.route.active>.nav-icon>.folder-icon-arrow_right{transform:rotate(90deg);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg)}.route.active>.ui-icon>.folder-icon-folder:before{content:"\e90c"}.wcp-container .route span.total-count{position:relative;font-size:10px;float:right;text-align:center;width:auto;display:block;margin:4px 8px 3px 3px;color:#23282d!important;line-height:16px;height:16px}.wcp-container .route.active-item>h3.title span.total-count{color:#fff!important}.dynamic-menu{position:absolute;left:auto;right:5px;background:#fff;width:170px;padding:0;z-index:101;-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.25);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.25);box-shadow:0 0 5px 0 rgba(0,0,0,.25)}.sticky-folders .dynamic-menu{left:auto;right:50px}.dynamic-menu li{position:relative;width:100%;display:block!important;padding:2px 0;margin:0}.dynamic-menu a{text-decoration:none;color:#333;position:relative;display:block;padding:5px 10px;line-height:18px;white-space:nowrap}.dynamic-menu ul>li>a>span,.dynamic-menu ul>li>a>span span{position:relative!important;display:inline-block;vertical-align:middle;margin-right:5px;top:auto!important;width:20px!important;height:20px!important;line-height:14px}#custom-menu .dynamic-menu ul>li>a .sticky-pin{line-height:20px}#custom-menu .dynamic-menu ul>li>a .sticky-pin i{font-size:16px!important}.dynamic-menu ul>li>a>span span{top:auto;height:auto;width:auto;margin:0;left:auto;vertical-align:baseline;display:inline}.dynamic-menu li.new-folder{border-bottom:solid 1px #d8d8d8}.dynamic-menu a.active,.dynamic-menu a:hover{background:#efefef;color:#000}.dynamic-menu ul li span{font-size:20px;vertical-align:middle}.dynamic-menu ul li span.sticky-folder-icon{width:20px}.dynamic-menu ul li span i{font-size:14px;line-height:16px;font-weight:400}.wcp-form-input{padding-left:35px;box-sizing:border-box;position:relative}.wcp-form-input input{width:100%}.wcp-form-btn{padding:4px 0 4px 2px}.wcp-form-input:before{content:"\e90d";font-family:folder-icon!important;speak:none;position:absolute;left:0;font-size:28px;top:5px}.add-new-folder-btn{margin-right:5px!important}.form-loader{width:100%;height:5px;margin:0 0 10px}.form-loader-count{width:0;height:5px;background:url(../images/form-loader.png);transition:all 2.5s linear;-webkit-transition:all 2s linear;-moz-transition:all 2.5s linear}.route.is-high>.ui-icon>i:before{content:"\e900"!important}.route.is-high.active>.ui-icon>i:before{content:"\e90c"!important;z-index:11;color:#444;font-size:20px}.route.is-high.active>.ui-icon>i:after{content:"\e907";margin-left:-1.2em;color:#444;font-size:11px;top:1px;position:absolute}.route.is-high.active.active-item>.ui-icon>i:after,.route.is-high.active.active-item>.ui-icon>i:before{color:#fff}li.active-menu{z-index:2!important}.wp-list-table th{width:auto!important}.wp-list-table th.column-title{width:35%!important}.fixed .column-author,.fixed .column-date,.fixed .column-format,.fixed .column-links,.fixed .column-parent,.fixed .column-posts{width:10%!important}.wp-list-table #wcp_move{width:20px!important}td.wcp_move.column-wcp_move{vertical-align:middle}.wp-list-table tr td .wcp-move-file{vertical-align:middle;opacity:0}.wp-list-table td.wcp_move.column-wcp_move.wcp-draggable,.wp-list-table tr:hover td .wcp-move-file{opacity:1}.wcp-drop-hover{background:#fa166b!important;z-index:2!important;color:#fff!important}.wcp-drop-hover i{color:#fff!important}.ui-draggable-dragging{z-index:1051!important}.wcp-hover-list{background:#fa166b!important;color:#fff;position:relative}.wcp-hover-list a{color:#fff}.wcp-hover-list span.total-count{color:#000}span.wcp-item{display:none}.wcp-move-file{cursor:move}.wcp-drop-hover-list a.folder-view{background:#008ec2;color:#fff;border:solid 1px #fff;position:relative}.wcp-drop-hover-list a.folder-view:before{width:100%;height:100%;content:"";position:absolute;top:-2px;left:-2px;border:solid 1px #008ec2;padding:1px;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px}.ui-draggable-dragging.wcp-move-file{z-index:5001;display:inline-block;border:solid 2px #0073aa;padding:5px 10px;border-radius:5px;background:#e4f6ff;position:fixed!important;max-width:230px;overflow:hidden;width:auto!important}.ui-draggable-dragging.wcp-move-file span{display:block;float:left}.ui-draggable-dragging.wcp-move-file span.wcp-move{margin-right:5px;display:block;float:left}.wcp-container .route span.title-text{position:relative;top:auto;left:auto;display:inline-block;font-size:16px;line-height:30px;height:30px;width:calc(100% - 100px);overflow:hidden;white-space:nowrap;text-align:left}.ui-resizable-handle.ui-resizable-e{position:absolute;top:0;height:100%;height:100vh;width:1px;right:0;border-right:1px solid #ccc;cursor:col-resize}.ui-resizable-handle.ui-resizable-e:before,.ui-resizable-handle.ui-resizable-w:before{content:"";top:25%;width:3px;height:30px;position:absolute;border-left:solid 1px #fa166b;border-right:solid 1px #fa166b;left:-1px}.ui-resizable-handle.ui-resizable-w{position:absolute;top:0;height:100%;height:100vh;width:1px;left:0;border-right:1px solid #ccc;cursor:col-resize}div#custom-menu{padding:0 10px 10px;background:#fff;box-shadow:0 4px 21px rgba(7,16,28,.1)}body:not(.no-hover-css) .sticky-folders li a:hover span.update-inline-record,body:not(.no-hover-css) .wcp-container .route h3:hover>span.update-inline-record{width:18px}.tree-structure li{display:block;width:auto;float:left;margin:0;padding:0}.tree-structure .folder-item{padding:4px;position:relative}.tree-structure .folder-view{display:block;border:none;color:#404040;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;position:relative;cursor:pointer;background:#f1f1f1;font-size:14px;line-height:16px}.tree-structure .folder-view span.item-name{display:block;padding:8px 15px 8px 30px;position:relative;width:100%;overflow:hidden;height:32px;font-size:14px;box-sizing:border-box}.folder-view span.item-name:before{content:"\e906";font-family:premio-folder!important;position:absolute;left:8px;font-size:16px;color:#a4c0d2}.folder-view.is-high span.item-name:before{content:"\e900"}.folder-view.is-post span.item-name:before{content:"\e901"}.tree-structure span.folder-option{position:absolute;right:0;font-family:folder-icon!important;top:0;font-size:20px;line-height:38px;z-index:1;cursor:pointer;display:none}.tree-structure .folder-view:hover span.folder-option{display:block}.tree-structure span.folder-option:hover{color:#f51366}.tree-structure span.folder-option:after{content:"\e90a"}.tree-structure li{position:relative}.tree-structure{margin-left:-8px;margin-right:-8px}.tree-structure .folder-view span.folder-title{width:100%;display:block}.swal2-popup .swal2-title{line-height:36px}.attachments-browser.ui-draggable-dragging .media-sidebar,.attachments-browser.ui-draggable-dragging .media-toolbar,.attachments-browser.ui-draggable-dragging .uploader-inline,.attachments-browser.ui-draggable-dragging ul.attachments{display:none}.attachments.ui-sortable.ui-draggable-dragging{z-index:5000}.selected-items{background:#0073aa;color:#fff;padding:10px 20px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;margin-top:0;cursor:none;font-size:12px}.media-frame,.media-frame .attachments-browser,.media-frame-content{overflow:inherit}.mCS-3d-dark.mCSB_scrollTools .mCSB_draggerRail,.mCS-3d.mCSB_scrollTools .mCSB_draggerRail{width:2px!important;background-color:transparent!important;box-shadow:none!important}.mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar{width:2px!important;background-color:#fa166b!important;margin:0 0 0 4px!important;padding:0!important}.mCSB_outside+.mCSB_scrollTools{right:-15px!important}body.upload-php.eml-grid #wpbody{position:relative!important;top:0!important;bottom:auto!important;left:auto!important;right:auto!important;height:auto}#footer-thankyou{display:none}span.upgrade-message{padding:0;background:#fff;display:inline-block;font-size:12px;color:#000}span.upgrade-message a.pink,span.upgrade-message span.pink{color:#ff5983;text-decoration:none;font-weight:700}.media-toolbar.sticky-media{position:fixed;top:32px;right:18px!important;left:auto}.media-position{width:1px;height:1px}.media-frame.mode-grid .media-toolbar{margin:0!important}.button-disabled{cursor:no-drop;pointer-events:none}.wcp-hide-show-buttons{position:absolute;top:25px;right:-20px;z-index:10001}html[dir=rtl] .wcp-hide-show-buttons{left:-20px;right:auto}.wcp-hide-show-buttons .toggle-buttons{background:#f51366;color:#fff;display:inline-block;margin:0;padding:0;float:left;-webkit-border-top-right-radius:50%;-webkit-border-bottom-right-radius:50%;-moz-border-radius-topright:50%;-moz-border-radius-bottomright:50%;border-top-right-radius:50%;border-bottom-right-radius:50%;display:none;width:20px;height:20px;cursor:pointer;position:relative}.wcp-hide-show-buttons:hover .toggle-buttons:after{content:"";width:100%;height:100%;background:0 0;position:absolute;top:0;left:0;-webkit-border-top-right-radius:50%;-webkit-border-bottom-right-radius:50%;-moz-border-radius-topright:50%;-moz-border-radius-bottomright:50%;border-top-right-radius:50%;border-bottom-right-radius:50%}html[dir=rtl] .wcp-hide-show-buttons .toggle-buttons{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;-webkit-border-top-left-radius:50%;-webkit-border-bottom-left-radius:50%;-moz-border-radius-top-left:50%;-moz-border-radius-bottom-left:50%;border-top-left-radius:50%;border-bottom-left-radius:50%}html[dir=rtl] .wcp-hide-show-buttons .toggle-buttons span{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.hide-folders-area .wcp-content{width:0!important}.hide-folders-area .wcp-container{display:none}.wcp-hide-show-buttons .toggle-buttons.active{display:block}#wcp-content.no-transition .wcp-container{display:none}button.button.organize-button{vertical-align:middle;text-decoration:none;display:inline-block;font-size:14px;padding:4px 10px;background:#f51366;color:#fff;border:solid 1px #f51366;border-radius:3px;line-height:14px;-webkit-box-shadow:0 3px 5px -3px #333;-moz-box-shadow:0 3px 5px -3px #333;box-shadow:0 3px 5px -3px #333;position:relative}button.button.organize-button:focus,button.button.organize-button:hover{color:#fff}button.button.organize-button:hover:after{content:"";width:100%;height:100%;background:rgba(0,0,0,.1);position:absolute;top:0;left:0}.tree-structure-content ul{margin:0;padding:0}.tree-structure-content{padding:5px 10px;background:#fff;margin:10px 0 15px;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;border:solid 1px #ccc}.tree-structure-content .tree-structure{height:40px;overflow:hidden;transition:.1s;-webkit-transition:.1s;-moz-transition:.1s}.tree-structure-content.active .tree-structure{height:auto}.folders-toggle-button{height:15px;text-align:center;position:relative}.folders-toggle-button span{background:#f51366;color:#fff;height:20px;width:30px;text-align:center;display:block;margin:0 auto;position:absolute;left:0;right:0;bottom:-10px;cursor:pointer;font-family:dashicons;font-size:20px;line-height:20px}.folders-toggle-button span:after{content:"\f347"}.tree-structure-content.active .folders-toggle-button span:after{content:"\f343"}span.media-info-message{vertical-align:middle;line-height:20px;font-weight:700;color:#f51366;padding:0 0 10px 0;display:none!important}span.media-info-message.active{display:block!important}.folder-popup-form{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.5);top:0;left:0;z-index:10001;display:none}.folder-popup-form.disabled{pointer-events:none}.popup-form-content{background:#fff;min-height:100px;width:400px;text-align:center;margin:0 auto;position:absolute;left:0;right:0;top:50%;transform:translate(0,-50%);-webkit-transform:translate(0,-50%);-moz-transform:translate(0,-50%);-o-transform:translate(0,-50%);-ms-transform:translate(0,-50%);padding:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;color:#484848}.folder-form-buttons a,.folder-form-buttons button{display:inline-flex;padding:0;text-decoration:none;margin:10px 3px;border-radius:4px;border:solid 1px #1da1f4;line-height:34px;font-weight:700;font-size:14px;box-sizing:border-box;height:36px;cursor:pointer;flex:1;justify-content:center}.folder-form-buttons a span,.folder-form-buttons button span{-webkit-animation:fa-spin .75s infinite linear;animation:fa-spin .75s infinite linear;padding:7px}.wcp-container .folder-tooltip{position:relative}.wcp-container .folder-tooltip::after,.wcp-container .folder-tooltip::before{text-transform:none;font-size:.9em;line-height:1;user-select:none;pointer-events:none;position:absolute;display:none;opacity:0}.wcp-container .folder-tooltip::before{content:'';border:5px solid transparent;z-index:1001}.wcp-container .folder-tooltip::after{content:attr(data-folder-tooltip);font-family:Helvetica,sans-serif;text-align:center;min-width:3em;max-width:21em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:1ch 1.5ch;border-radius:.3ch;box-shadow:0 1em 2em -.5em rgba(0,0,0,.35);background:#333;color:#fff;z-index:1000}.wcp-container .folder-tooltip:hover::after,.wcp-container .folder-tooltip:hover::before{display:block;opacity:1}.wcp-container .folder-tooltip:not([flow])::before,.wcp-container .folder-tooltip[flow^=up]::before{bottom:100%;border-bottom-width:0;border-top-color:#333}.wcp-container .folder-tooltip:not([flow])::after,.wcp-container .folder-tooltip[flow^=up]::after{bottom:calc(100% + 5px)}.wcp-container .folder-tooltip:not([flow])::after,.wcp-container .folder-tooltip:not([flow])::before,.wcp-container .folder-tooltip[flow^=up]::after,.wcp-container .folder-tooltip[flow^=up]::before{left:50%;transform:translate(-50%,-.5em)}.wp-core-ui .button-primary.select-all-item-btn{margin:11px 11px 11px 0;display:none!important}.wp-core-ui .button-primary.select-all-item-btn.active{display:inline-block!important}.form-options>ul>li.last.folder-checkbox{padding:5px 0 0}#custom-menu input.checkbox{display:none}#custom-menu.show-folder-checkbox input.checkbox{display:block;margin:5px 0 0 0}#custom-menu.show-folder-checkbox h3.title>.ui-icon>i,#custom-menu.show-folder-checkbox h3.title>.ui-icon>img{display:none!important}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.folder-form-buttons a:focus,.folder-form-buttons a:hover,.folder-form-buttons button:focus,.folder-form-buttons button:hover{color:#fff;outline:0}.folder-form-buttons a:focus{outline:0;outline:0}.form-cancel-btn,a.form-cancel-btn:hover{background-color:#fff;color:#3085d6;outline:0}.form-submit-btn{background-color:#3085d6;color:#fff;outline:0}.add-update-folder-title{display:block;position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;text-align:center;text-transform:none;word-wrap:break-word;font-weight:700;font-size:22px;line-height:26px}.folder-form-message{font-size:15px;line-height:18px;color:#484848;padding:25px 70px}.folder-form-errors{margin:0 0 10px 0;padding:8px 0;background:#ffe4e4;color:#a20000;display:none}.folder-form-errors.active{display:block}span.folder-loader-ajax{margin:0;line-height:30px;display:none;vertical-align:middle}.folder-loader-ajax.active{display:inline-block}@-webkit-keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes drawCircle{0%{stroke-dashoffset:151px}100%{stroke-dashoffset:0}}@keyframes drawCircle{0%{stroke-dashoffset:151px}100%{stroke-dashoffset:0}}@-webkit-keyframes drawCheck{0%{stroke-dashoffset:36px}100%{stroke-dashoffset:0}}@keyframes drawCheck{0%{stroke-dashoffset:36px}100%{stroke-dashoffset:0}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}#successAnimationCircle{stroke-dasharray:151px 151px;stroke:#2ce0a7}#successAnimationCheck{stroke-dasharray:36px 36px;stroke:#2ce0a7}#successAnimationResult{fill:#2ce0a7;opacity:0}svg#successAnimation{width:30px;height:34px;padding:0;display:none;float:left}#successAnimation.active{display:inline-block}.folder-loader-ajax img{display:none}.folder-loader-ajax img.active{display:inline-block}#successAnimation.animated{-webkit-animation:1s ease-out 0s 1 both scaleAnimation;animation:1s ease-out 0s 1 both scaleAnimation}#successAnimation.animated #successAnimationCircle{-webkit-animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCircle,.3s linear .9s 1 both fadeOut;animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCircle,.3s linear .9s 1 both fadeOut}#successAnimation.animated #successAnimationCheck{-webkit-animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCheck,.3s linear .9s 1 both fadeOut;animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCheck,.3s linear .9s 1 both fadeOut}#successAnimation.animated #successAnimationResult{-webkit-animation:.3s linear .9s both fadeIn;animation:.3s linear .9s both fadeIn}.mCSB_scrollTools a+.mCSB_draggerContainer{margin:10px 0!important}.popup-folder-title{font-weight:700;font-size:24px;padding:0 0 20px 0}.select-box{padding:20px 0 10px 0}.select-box select{width:100%;max-width:300px}.actions #media_folder,select.media-select-folder{width:132px}select#media-attachment-taxonomy-filter{width:132px}.custom-media-select{float:right;padding:10px 0 0 0;display:none}.custom-media-select.active{display:block}.folder-progress{background:#b4b9be;border-radius:4px;margin:5px 0 0 0;position:relative}.folder-meter{height:20px;position:relative;background:#f1f1f1;padding:0;width:0%;border-radius:4px;-webkit-transition:all .2s linear;transition:all .2s linear}.folder-meter>span{display:block;height:100%;-webkit-box-shadow:inset 0 2px 9px rgba(255,255,255,.3),inset 0 -2px 6px rgba(0,0,0,.4);-moz-box-shadow:inset 0 2px 9px rgba(255,255,255,.3),inset 0 -2px 6px rgba(0,0,0,.4);box-shadow:inset 0 2px 9px rgba(255,255,255,.3),inset 0 -2px 6px rgba(0,0,0,.4);position:relative;overflow:hidden;border-radius:4px}.folder-animate>span>span,.folder-meter>span:after,.folder-progress:after{content:"";position:absolute;border-radius:4px;top:0;left:0;bottom:0;right:0;background-image:-webkit-gradient(linear,0 0,100% 100%,color-stop(.25,rgba(255,255,255,.2)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.2)),color-stop(.75,rgba(255,255,255,.2)),color-stop(.75,transparent),to(transparent));background-image:-moz-linear-gradient(-45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);z-index:1;-webkit-background-size:50px 50px;-moz-background-size:50px 50px;-webkit-animation:move 2s linear infinite;overflow:hidden}.folder-animate>span:after{display:none}@-webkit-keyframes move{0%{background-position:0 0}100%{background-position:50px 50px}}.media-folder-loader{padding:10px 0 15px;display:none}.media-folder-loader>span{font-weight:700}.sticky-folders{display:none;padding:0;margin:10px 0 5px;border-top:solid 1px #e9e5e5}.top-settings{background:#fff;padding:10px 10px 5px;-webkit-border-top-left-radius:4px;-webkit-border-top-right-radius:4px;-moz-border-radius-topleft:4px;-moz-border-radius-topright:4px;border-top-left-radius:4px;border-top-right-radius:4px;box-shadow:0 4px 21px rgba(7,16,28,.1)}.sticky-folders.active{display:block}.sticky-folders ul{margin:0;padding:0}.sticky-folders>ul>li{display:block;margin:0;padding:0}.sticky-folders>ul>li>a{display:block;color:#333;padding:0 0 0 10px;border-radius:3px;text-decoration:none;font-size:14px;line-height:30px;position:relative}.sticky-folders ul li a.active,body:not(.no-hover-css) .sticky-folders ul li a:hover{background:#dfdfdf;border-radius:3px}.sticky-folders ul li a.active-item{background-color:#008ec2!important;color:#fff}.sticky-folders ul li a.active-item img{filter:invert(100%);-webkit-filter:invert(100%)}.sticky-folders>ul>li>a>span{display:inline-block;vertical-align:middle;line-height:30px}.sticky-folders ul li a span.update-inline-record{line-height:30px;padding:0 0 0 5px;height:30px}.sticky-folders ul li a span.folder-count{padding:0 8px 0 3px}.sticky-wcp-custom-form a:focus{box-shadow:none;outline:0}span.folder-count{float:right;background:0 0;padding:0;font-size:10px;line-height:16px;border-radius:2px}span.folder-count:empty{display:none}.sticky-title{font-size:16px;font-weight:700;padding:7px}.sticky-title img{display:inline-block;vertical-align:middle;height:20px;width:20px}.sticky-folder-icon img{width:100%;filter:invert(50%);-webkit-filter:invert(50%)}.dynamic-menu .sticky-folder:hover img{filter:invert(0);-webkit-filter:invert(0)}.form-options>ul>li.last>a.sort-folder-order{width:28px;padding:5px;text-align:center;display:inline-block;box-sizing:border-box}.sort-folder-order svg{width:100%;height:100%;fill:#000}.sort-folder-order:hover svg{fill:#fff}.folder-order{position:relative}.folder-sort-menu{position:absolute;right:0;width:120px;z-index:101;background:#fff;-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.25);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.25);box-shadow:0 0 5px 0 rgba(0,0,0,.25);display:none}.folder-order.active .folder-sort-menu{display:block}.folder-order.active .sort-folder-order{background:#404040;color:#fff}.folder-order.active .sort-folder-order svg{fill:#fff}.folder-sort-menu li{display:block;margin:0;padding:0;background:0 0}.folder-sort-menu li a{display:block;margin:0;padding:3px 5px;background:0 0;color:#848484;text-decoration:none;font-size:14px}.folder-sort-menu li a.active,.folder-sort-menu li a:hover{background:#efefef;color:#000}.dynamic-menu.bottom-fix{bottom:0}.folder-form-buttons{display:flex}.folder-group{position:relative;margin:45px auto 15px;padding:0 2px}.folder-grouptextarea{resize:none}.folder-group input,.folder-group textarea{background:0 0;font-size:14px;padding:0 0 0 15px;display:block;width:100%;border-radius:4px;border:1px solid #484848;height:34px;line-height:34px;color:#484848}.folder-group input:focus,.folder-group textarea:focus{outline:0}.folder-group input:focus~label,.folder-group input:valid~label,.folder-group textarea:focus~label,.folder-group textarea:valid~label{top:-9px;background:#fff;padding:0 5px;font-weight:400;font-size:12px;line-height:14px;color:#aeaeae}.folder-group input:focus~.bar:before,.folder-group textarea:focus~.bar:before{width:320px}.folder-group input[type=password]{letter-spacing:.3em}.folder-group label{font-size:14px;font-weight:500;position:absolute;pointer-events:none;left:20px;top:10px;-webkit-transition:.3s ease all;transition:.3s ease all;color:#484848}.folder-group .folder-bar{position:relative;display:block;width:320px}.folder-group .folder-bar:before{content:'';height:2px;width:0;bottom:0;position:absolute;background:#2196f3;-webkit-transition:.3s ease all;transition:.3s ease all;left:0}#custom-menu [class*=" pfolder-"],#custom-menu [class^=pfolder-],.sticky-folders i{font-size:12px}span.create_new_folder{width:26px;height:26px;line-height:26px;font-size:14px;background:rgba(255,255,255,.4);backdrop-filter:blur(16px);border-radius:4px;text-align:center;margin:0 15px 0 0}.folder-search-form{padding:0 0 10px 0;position:relative}.folder-search-form input{background:#fff;border:1px solid #dbdbdb;box-sizing:border-box;border-radius:4px;height:32px;line-height:32px;box-sizing:border-box;padding:0 5px;width:100%;outline:0;box-shadow:none!important}.folder-search-form span{position:absolute;color:#aeaeae;right:0;top:0;height:32px;line-height:32px;width:32px;text-align:center}.folder-separator{padding:0 10px;height:1px;background:#e9e5e5;margin:0 0 10px 0}#custom-menu.has-filter li.route{display:none!important}#custom-menu.has-filter li.route.has-search{display:block!important}#custom-menu.has-filter h3 span.title-text.has-search-text{font-weight:700}.hide-folders-area .ui-resizable-handle.ui-resizable-e{display:none!important}.pull-right{float:right;display:block;line-height:22px}.folder-separator-2{padding:0;height:1px;background:#e9e5e5;margin:0 0 5px 0}.mCSB_scrollTools{width:10px!important}.mCSB_inside>.mCSB_container{margin-right:0!important}#custom-menu .route.has-sub-tree.has-search>.nav-icon>.pfolder-arrow-down{transform:rotate(0)}@media screen and (max-width:960px){.wcp-content{left:36px}html[dir=rtl] .wcp-content{right:36px;left:auto}}@media screen and (max-width:780px){.wcp-content{left:0}html[dir=rtl] .wcp-content{right:0}}@media screen and (max-width:640px){.wcp-content{left:0;position:relative!important;width:100%!important;padding-bottom:100px;top:0;right:0;display:block}.ui-resizable-handle.ui-resizable-e{display:none!important}.hide-folders-area .wcp-container{display:block}.wcp-hide-show-buttons{display:none}.hide-folders-area .wcp-content{width:100%!important}body.wp-admin #wpcontent{padding:0!important}#wpbody-content{padding-bottom:30px}}
|
assets/css/folders.css
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#custom-scroll-menu a, #custom-scroll-menu a:hover, #custom-scroll-menu a:focus {
|
2 |
+
text-decoration: none;
|
3 |
+
color: #333;
|
4 |
+
outline: none;
|
5 |
+
box-shadow: none;
|
6 |
+
}
|
7 |
+
#js-tree-menu {
|
8 |
+
padding: 10px 10px 10px 0;
|
9 |
+
background: #fff;
|
10 |
+
box-shadow: 0 4px 21px rgba(7,16,28,.1);
|
11 |
+
}
|
12 |
+
.pfolder-folder-close {
|
13 |
+
font-size: 16px;
|
14 |
+
}
|
15 |
+
.jstree-open > a > .pfolder-folder-close:before {
|
16 |
+
content: "\e902";
|
17 |
+
}
|
18 |
+
span.folder-actions {
|
19 |
+
position: absolute;
|
20 |
+
right: 4px;
|
21 |
+
}
|
22 |
+
.folder-actions span i {
|
23 |
+
font-size: 10px;
|
24 |
+
width: 16px;
|
25 |
+
text-align: center;
|
26 |
+
}
|
27 |
+
.folder-actions span {
|
28 |
+
width: 0px;
|
29 |
+
overflow: hidden;
|
30 |
+
height: 30px;
|
31 |
+
line-height: 30px;
|
32 |
+
transition: all 0.2s linear;
|
33 |
+
display: inline-block;
|
34 |
+
font-size: 10px;
|
35 |
+
text-align: center;
|
36 |
+
}
|
37 |
+
.folder-actions span.premio-folder-count {
|
38 |
+
width: auto;
|
39 |
+
}
|
40 |
+
a.jstree-anchor:hover span.folder-inline-edit {
|
41 |
+
width: 20px;
|
42 |
+
}
|
43 |
+
#jstree-dnd {
|
44 |
+
background-color: #cecece;
|
45 |
+
border-radius: 3px;
|
46 |
+
display: block;
|
47 |
+
height: 32px;
|
48 |
+
line-height: 32px;
|
49 |
+
margin: 0;
|
50 |
+
opacity: .8;
|
51 |
+
overflow: hidden;
|
52 |
+
padding: 0 10px 0 40px;
|
53 |
+
-o-text-overflow: ellipsis;
|
54 |
+
text-overflow: ellipsis;
|
55 |
+
white-space: nowrap;
|
56 |
+
width: 260px
|
57 |
+
}
|
58 |
+
|
59 |
+
#jstree-dnd .jstree-icon {
|
60 |
+
top: 6px;
|
61 |
+
background-position: 50%;
|
62 |
+
background-repeat: no-repeat;
|
63 |
+
background-size: contain;
|
64 |
+
height: 20px;
|
65 |
+
width: 20px;
|
66 |
+
display: none;
|
67 |
+
}
|
68 |
+
#js-tree-menu .folder-checkbox {
|
69 |
+
display: none;
|
70 |
+
}
|
71 |
+
#js-tree-menu.show-folder-checkbox .folder-checkbox {
|
72 |
+
display: inline-block;
|
73 |
+
}
|
74 |
+
#js-tree-menu.show-folder-checkbox .pfolder-folder-close {
|
75 |
+
display: none;
|
76 |
+
}
|
77 |
+
li.jstree-node.is-high > a .star-icon {
|
78 |
+
width: 16px;
|
79 |
+
text-align: center;
|
80 |
+
color: #ffc90e;
|
81 |
+
}
|
82 |
+
li.jstree-node.is-sticky > a .sticky-icon {
|
83 |
+
width: 16px;
|
84 |
+
text-align: center;
|
85 |
+
}
|
86 |
+
li.jstree-node.is-sticky > a .sticky-icon i {
|
87 |
+
font-size: 12px;
|
88 |
+
}
|
89 |
+
li.jstree-node .jstree-hovered .star-icon, li.jstree-node .jstree-hovered .sticky-icon {
|
90 |
+
width: 0px !important;
|
91 |
+
}
|
92 |
+
.js-tree-data {
|
93 |
+
display: none;
|
94 |
+
}
|
95 |
+
.cssload-container {
|
96 |
+
width: 100%;
|
97 |
+
height: 49px;
|
98 |
+
text-align: center;
|
99 |
+
}
|
100 |
+
|
101 |
+
.cssload-tube-tunnel {
|
102 |
+
width: 49px;
|
103 |
+
height: 49px;
|
104 |
+
margin: 0 auto;
|
105 |
+
border: 4px solid;
|
106 |
+
border-radius: 50%;
|
107 |
+
border-color: #ccc;
|
108 |
+
animation: cssload-scale 1035ms infinite linear;
|
109 |
+
-o-animation: cssload-scale 1035ms infinite linear;
|
110 |
+
-ms-animation: cssload-scale 1035ms infinite linear;
|
111 |
+
-webkit-animation: cssload-scale 1035ms infinite linear;
|
112 |
+
-moz-animation: cssload-scale 1035ms infinite linear;
|
113 |
+
}
|
114 |
+
|
115 |
+
.ajax-preloader {
|
116 |
+
padding: 50px 0;
|
117 |
+
}
|
118 |
+
|
119 |
+
@keyframes cssload-scale {
|
120 |
+
0% { transform: scale(0); transform: scale(0); }
|
121 |
+
90% { transform: scale(0.7); transform: scale(0.7); }
|
122 |
+
100% { transform: scale(1); transform: scale(1); }
|
123 |
+
}
|
124 |
+
|
125 |
+
@-o-keyframes cssload-scale {
|
126 |
+
0% { -o-transform: scale(0); transform: scale(0); }
|
127 |
+
90% { -o-transform: scale(0.7); transform: scale(0.7); }
|
128 |
+
100% { -o-transform: scale(1); transform: scale(1); }
|
129 |
+
}
|
130 |
+
|
131 |
+
@-ms-keyframes cssload-scale {
|
132 |
+
0% { -ms-transform: scale(0); transform: scale(0); }
|
133 |
+
90% { -ms-transform: scale(0.7); transform: scale(0.7); }
|
134 |
+
100% { -ms-transform: scale(1); transform: scale(1); }
|
135 |
+
}
|
136 |
+
|
137 |
+
@-webkit-keyframes cssload-scale {
|
138 |
+
0% { -webkit-transform: scale(0); transform: scale(0); }
|
139 |
+
90% { -webkit-transform: scale(0.7); transform: scale(0.7); }
|
140 |
+
100% { -webkit-transform: scale(1); transform: scale(1); }
|
141 |
+
}
|
142 |
+
|
143 |
+
@-moz-keyframes cssload-scale {
|
144 |
+
0% { -moz-transform: scale(0); transform: scale(0); }
|
145 |
+
90% { -moz-transform: scale(0.7); transform: scale(0.7); }
|
146 |
+
100% { -moz-transform: scale(1); transform: scale(1); }
|
147 |
+
}
|
148 |
+
.sticky-folders > ul > li > a > span.folder-actions > span {
|
149 |
+
transition: all 0.25s linear;
|
150 |
+
}
|
151 |
+
.sticky-folders > ul > li > a:hover .star-icon {
|
152 |
+
width: 0px !important;
|
153 |
+
}
|
154 |
+
.sticky-folders > ul > li > a:hover .folder-inline-edit {
|
155 |
+
width: 16px !important;
|
156 |
+
text-align: center;
|
157 |
+
}
|
158 |
+
.sticky-folders li.is-high a span.star-icon {
|
159 |
+
width: 16px;
|
160 |
+
text-align: center;
|
161 |
+
color: #ffc90e;
|
162 |
+
}
|
163 |
+
.folder-menu-content .cssload-container {
|
164 |
+
margin: 100px 0 0 0;
|
165 |
+
}
|
assets/css/folders.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
#custom-scroll-menu a,#custom-scroll-menu a:focus,#custom-scroll-menu a:hover{text-decoration:none;color:#333;outline:0;box-shadow:none}#js-tree-menu{padding:10px 10px 10px 0;background:#fff;box-shadow:0 4px 21px rgba(7,16,28,.1)}.pfolder-folder-close{font-size:16px}.jstree-open>a>.pfolder-folder-close:before{content:"\e902"}span.folder-actions{position:absolute;right:4px}.folder-actions span i{font-size:10px;width:16px;text-align:center}.folder-actions span{width:0;overflow:hidden;height:30px;line-height:30px;transition:all .2s linear;display:inline-block;font-size:10px;text-align:center}.folder-actions span.premio-folder-count{width:auto}a.jstree-anchor:hover span.folder-inline-edit{width:20px}#jstree-dnd{background-color:#cecece;border-radius:3px;display:block;height:32px;line-height:32px;margin:0;opacity:.8;overflow:hidden;padding:0 10px 0 40px;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;width:260px}#jstree-dnd .jstree-icon{top:6px;background-position:50%;background-repeat:no-repeat;background-size:contain;height:20px;width:20px;display:none}#js-tree-menu .folder-checkbox{display:none}#js-tree-menu.show-folder-checkbox .folder-checkbox{display:inline-block}#js-tree-menu.show-folder-checkbox .pfolder-folder-close{display:none}li.jstree-node.is-high>a .star-icon{width:16px;text-align:center;color:#ffc90e}li.jstree-node.is-sticky>a .sticky-icon{width:16px;text-align:center}li.jstree-node.is-sticky>a .sticky-icon i{font-size:12px}li.jstree-node .jstree-hovered .star-icon,li.jstree-node .jstree-hovered .sticky-icon{width:0!important}.js-tree-data{display:none}.cssload-container{width:100%;height:49px;text-align:center}.cssload-tube-tunnel{width:49px;height:49px;margin:0 auto;border:4px solid;border-radius:50%;border-color:#ccc;animation:cssload-scale 1035ms infinite linear;-o-animation:cssload-scale 1035ms infinite linear;-ms-animation:cssload-scale 1035ms infinite linear;-webkit-animation:cssload-scale 1035ms infinite linear;-moz-animation:cssload-scale 1035ms infinite linear}.ajax-preloader{padding:50px 0}@keyframes cssload-scale{0%{transform:scale(0);transform:scale(0)}90%{transform:scale(.7);transform:scale(.7)}100%{transform:scale(1);transform:scale(1)}}@-o-keyframes cssload-scale{0%{-o-transform:scale(0);transform:scale(0)}90%{-o-transform:scale(.7);transform:scale(.7)}100%{-o-transform:scale(1);transform:scale(1)}}@-ms-keyframes cssload-scale{0%{-ms-transform:scale(0);transform:scale(0)}90%{-ms-transform:scale(.7);transform:scale(.7)}100%{-ms-transform:scale(1);transform:scale(1)}}@-webkit-keyframes cssload-scale{0%{-webkit-transform:scale(0);transform:scale(0)}90%{-webkit-transform:scale(.7);transform:scale(.7)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-moz-keyframes cssload-scale{0%{-moz-transform:scale(0);transform:scale(0)}90%{-moz-transform:scale(.7);transform:scale(.7)}100%{-moz-transform:scale(1);transform:scale(1)}}.sticky-folders>ul>li>a>span.folder-actions>span{transition:all .25s linear}.sticky-folders>ul>li>a:hover .star-icon{width:0!important}.sticky-folders>ul>li>a:hover .folder-inline-edit{width:16px!important;text-align:center}.sticky-folders li.is-high a span.star-icon{width:16px;text-align:center;color:#ffc90e}.folder-menu-content .cssload-container{margin:100px 0 0 0}
|
assets/css/jstree.css
ADDED
@@ -0,0 +1,1113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* jsTree default theme */
|
2 |
+
.jstree-node,
|
3 |
+
.jstree-children,
|
4 |
+
.jstree-container-ul {
|
5 |
+
display: block;
|
6 |
+
margin: 0;
|
7 |
+
padding: 0;
|
8 |
+
list-style-type: none;
|
9 |
+
list-style-image: none;
|
10 |
+
}
|
11 |
+
.jstree-node {
|
12 |
+
white-space: nowrap;
|
13 |
+
}
|
14 |
+
.jstree-anchor {
|
15 |
+
display: inline-block;
|
16 |
+
color: black;
|
17 |
+
white-space: nowrap;
|
18 |
+
padding: 0 4px 0 1px;
|
19 |
+
margin: 0;
|
20 |
+
vertical-align: top;
|
21 |
+
}
|
22 |
+
.jstree-anchor:focus {
|
23 |
+
outline: 0;
|
24 |
+
}
|
25 |
+
.jstree-anchor,
|
26 |
+
.jstree-anchor:link,
|
27 |
+
.jstree-anchor:visited,
|
28 |
+
.jstree-anchor:hover,
|
29 |
+
.jstree-anchor:active {
|
30 |
+
text-decoration: none;
|
31 |
+
}
|
32 |
+
.jstree-icon {
|
33 |
+
display: inline-block;
|
34 |
+
text-decoration: none;
|
35 |
+
margin: 0;
|
36 |
+
padding: 0;
|
37 |
+
vertical-align: top;
|
38 |
+
text-align: center;
|
39 |
+
}
|
40 |
+
.jstree-icon:empty {
|
41 |
+
display: inline-block;
|
42 |
+
text-decoration: none;
|
43 |
+
margin: 0;
|
44 |
+
padding: 0;
|
45 |
+
vertical-align: top;
|
46 |
+
text-align: center;
|
47 |
+
}
|
48 |
+
.jstree-ocl {
|
49 |
+
cursor: pointer;
|
50 |
+
}
|
51 |
+
.jstree-leaf > .jstree-ocl {
|
52 |
+
cursor: default;
|
53 |
+
}
|
54 |
+
.jstree .jstree-open > .jstree-children {
|
55 |
+
display: block;
|
56 |
+
}
|
57 |
+
.jstree .jstree-closed > .jstree-children,
|
58 |
+
.jstree .jstree-leaf > .jstree-children {
|
59 |
+
display: none;
|
60 |
+
}
|
61 |
+
.jstree-anchor > .jstree-themeicon {
|
62 |
+
margin-right: 2px;
|
63 |
+
}
|
64 |
+
.jstree-no-icons .jstree-themeicon,
|
65 |
+
.jstree-anchor > .jstree-themeicon-hidden {
|
66 |
+
display: none;
|
67 |
+
}
|
68 |
+
.jstree-hidden,
|
69 |
+
.jstree-node.jstree-hidden {
|
70 |
+
display: none;
|
71 |
+
}
|
72 |
+
.jstree-rtl .jstree-anchor {
|
73 |
+
padding: 0 1px 0 4px;
|
74 |
+
}
|
75 |
+
.jstree-rtl .jstree-anchor > .jstree-themeicon {
|
76 |
+
margin-left: 2px;
|
77 |
+
margin-right: 0;
|
78 |
+
}
|
79 |
+
.jstree-rtl .jstree-node {
|
80 |
+
margin-left: 0;
|
81 |
+
}
|
82 |
+
.jstree-rtl .jstree-container-ul > .jstree-node {
|
83 |
+
margin-right: 0;
|
84 |
+
}
|
85 |
+
.jstree-wholerow-ul {
|
86 |
+
position: relative;
|
87 |
+
display: inline-block;
|
88 |
+
min-width: 100%;
|
89 |
+
}
|
90 |
+
.jstree-wholerow-ul .jstree-leaf > .jstree-ocl {
|
91 |
+
cursor: pointer;
|
92 |
+
}
|
93 |
+
.jstree-wholerow-ul .jstree-anchor,
|
94 |
+
.jstree-wholerow-ul .jstree-icon {
|
95 |
+
position: relative;
|
96 |
+
}
|
97 |
+
.jstree-wholerow-ul .jstree-wholerow {
|
98 |
+
width: 100%;
|
99 |
+
cursor: pointer;
|
100 |
+
position: absolute;
|
101 |
+
left: 0;
|
102 |
+
-webkit-user-select: none;
|
103 |
+
-moz-user-select: none;
|
104 |
+
-ms-user-select: none;
|
105 |
+
user-select: none;
|
106 |
+
}
|
107 |
+
.jstree-contextmenu .jstree-anchor {
|
108 |
+
-webkit-user-select: none;
|
109 |
+
/* disable selection/Copy of UIWebView */
|
110 |
+
-webkit-touch-callout: none;
|
111 |
+
/* disable the IOS popup when long-press on a link */
|
112 |
+
}
|
113 |
+
.vakata-context {
|
114 |
+
display: none;
|
115 |
+
}
|
116 |
+
.vakata-context,
|
117 |
+
.vakata-context ul {
|
118 |
+
margin: 0;
|
119 |
+
padding: 2px;
|
120 |
+
position: absolute;
|
121 |
+
background: #f5f5f5;
|
122 |
+
border: 1px solid #979797;
|
123 |
+
box-shadow: 2px 2px 2px #999999;
|
124 |
+
}
|
125 |
+
.vakata-context ul {
|
126 |
+
list-style: none;
|
127 |
+
left: 100%;
|
128 |
+
margin-top: -2.7em;
|
129 |
+
margin-left: -4px;
|
130 |
+
}
|
131 |
+
.vakata-context .vakata-context-right ul {
|
132 |
+
left: auto;
|
133 |
+
right: 100%;
|
134 |
+
margin-left: auto;
|
135 |
+
margin-right: -4px;
|
136 |
+
}
|
137 |
+
.vakata-context li {
|
138 |
+
list-style: none;
|
139 |
+
}
|
140 |
+
.vakata-context li > a {
|
141 |
+
display: block;
|
142 |
+
padding: 0 2em 0 2em;
|
143 |
+
text-decoration: none;
|
144 |
+
width: auto;
|
145 |
+
color: black;
|
146 |
+
white-space: nowrap;
|
147 |
+
line-height: 2.4em;
|
148 |
+
text-shadow: 1px 1px 0 white;
|
149 |
+
border-radius: 1px;
|
150 |
+
}
|
151 |
+
.vakata-context li > a:hover {
|
152 |
+
position: relative;
|
153 |
+
background-color: #e8eff7;
|
154 |
+
box-shadow: 0 0 2px #0a6aa1;
|
155 |
+
}
|
156 |
+
.vakata-context li > a.vakata-context-parent {
|
157 |
+
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");
|
158 |
+
background-position: right center;
|
159 |
+
background-repeat: no-repeat;
|
160 |
+
}
|
161 |
+
.vakata-context li > a:focus {
|
162 |
+
outline: 0;
|
163 |
+
}
|
164 |
+
.vakata-context .vakata-context-hover > a {
|
165 |
+
position: relative;
|
166 |
+
background-color: #e8eff7;
|
167 |
+
box-shadow: 0 0 2px #0a6aa1;
|
168 |
+
}
|
169 |
+
.vakata-context .vakata-context-separator > a,
|
170 |
+
.vakata-context .vakata-context-separator > a:hover {
|
171 |
+
background: white;
|
172 |
+
border: 0;
|
173 |
+
border-top: 1px solid #e2e3e3;
|
174 |
+
height: 1px;
|
175 |
+
min-height: 1px;
|
176 |
+
max-height: 1px;
|
177 |
+
padding: 0;
|
178 |
+
margin: 0 0 0 2.4em;
|
179 |
+
border-left: 1px solid #e0e0e0;
|
180 |
+
text-shadow: 0 0 0 transparent;
|
181 |
+
box-shadow: 0 0 0 transparent;
|
182 |
+
border-radius: 0;
|
183 |
+
}
|
184 |
+
.vakata-context .vakata-contextmenu-disabled a,
|
185 |
+
.vakata-context .vakata-contextmenu-disabled a:hover {
|
186 |
+
color: silver;
|
187 |
+
background-color: transparent;
|
188 |
+
border: 0;
|
189 |
+
box-shadow: 0 0 0;
|
190 |
+
}
|
191 |
+
.vakata-context .vakata-contextmenu-disabled > a > i {
|
192 |
+
filter: grayscale(100%);
|
193 |
+
}
|
194 |
+
.vakata-context li > a > i {
|
195 |
+
text-decoration: none;
|
196 |
+
display: inline-block;
|
197 |
+
width: 2.4em;
|
198 |
+
height: 2.4em;
|
199 |
+
background: transparent;
|
200 |
+
margin: 0 0 0 -2em;
|
201 |
+
vertical-align: top;
|
202 |
+
text-align: center;
|
203 |
+
line-height: 2.4em;
|
204 |
+
}
|
205 |
+
.vakata-context li > a > i:empty {
|
206 |
+
width: 2.4em;
|
207 |
+
line-height: 2.4em;
|
208 |
+
}
|
209 |
+
.vakata-context li > a .vakata-contextmenu-sep {
|
210 |
+
display: inline-block;
|
211 |
+
width: 1px;
|
212 |
+
height: 2.4em;
|
213 |
+
background: white;
|
214 |
+
margin: 0 0.5em 0 0;
|
215 |
+
border-left: 1px solid #e2e3e3;
|
216 |
+
}
|
217 |
+
.vakata-context .vakata-contextmenu-shortcut {
|
218 |
+
font-size: 0.8em;
|
219 |
+
color: silver;
|
220 |
+
opacity: 0.5;
|
221 |
+
display: none;
|
222 |
+
}
|
223 |
+
.vakata-context-rtl ul {
|
224 |
+
left: auto;
|
225 |
+
right: 100%;
|
226 |
+
margin-left: auto;
|
227 |
+
margin-right: -4px;
|
228 |
+
}
|
229 |
+
.vakata-context-rtl li > a.vakata-context-parent {
|
230 |
+
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");
|
231 |
+
background-position: left center;
|
232 |
+
background-repeat: no-repeat;
|
233 |
+
}
|
234 |
+
.vakata-context-rtl .vakata-context-separator > a {
|
235 |
+
margin: 0 2.4em 0 0;
|
236 |
+
border-left: 0;
|
237 |
+
border-right: 1px solid #e2e3e3;
|
238 |
+
}
|
239 |
+
.vakata-context-rtl .vakata-context-left ul {
|
240 |
+
right: auto;
|
241 |
+
left: 100%;
|
242 |
+
margin-left: -4px;
|
243 |
+
margin-right: auto;
|
244 |
+
}
|
245 |
+
.vakata-context-rtl li > a > i {
|
246 |
+
margin: 0 -2em 0 0;
|
247 |
+
}
|
248 |
+
.vakata-context-rtl li > a .vakata-contextmenu-sep {
|
249 |
+
margin: 0 0 0 0.5em;
|
250 |
+
border-left-color: white;
|
251 |
+
background: #e2e3e3;
|
252 |
+
}
|
253 |
+
#jstree-marker {
|
254 |
+
position: absolute;
|
255 |
+
top: 0;
|
256 |
+
left: 0;
|
257 |
+
margin: -5px 0 0 0;
|
258 |
+
padding: 0;
|
259 |
+
border-right: 0;
|
260 |
+
border-top: 5px solid transparent;
|
261 |
+
border-bottom: 5px solid transparent;
|
262 |
+
border-left: 5px solid;
|
263 |
+
width: 0;
|
264 |
+
height: 0;
|
265 |
+
font-size: 0;
|
266 |
+
line-height: 0;
|
267 |
+
}
|
268 |
+
{
|
269 |
+
line-height: 16px;
|
270 |
+
margin: 0;
|
271 |
+
padding: 4px;
|
272 |
+
}
|
273 |
+
.jstree-icon,
|
274 |
+
.jstree-copy {
|
275 |
+
display: inline-block;
|
276 |
+
text-decoration: none;
|
277 |
+
margin: 0 2px 0 0;
|
278 |
+
padding: 0;
|
279 |
+
width: 16px;
|
280 |
+
height: 16px;
|
281 |
+
}
|
282 |
+
.jstree-ok {
|
283 |
+
background: green;
|
284 |
+
}
|
285 |
+
.jstree-er {
|
286 |
+
background: red;
|
287 |
+
}
|
288 |
+
.jstree-copy {
|
289 |
+
margin: 0 2px 0 2px;
|
290 |
+
}
|
291 |
+
.jstree-default .jstree-node,
|
292 |
+
.jstree-default .jstree-icon {
|
293 |
+
background-repeat: no-repeat;
|
294 |
+
background-color: transparent;
|
295 |
+
}
|
296 |
+
.jstree-default .jstree-anchor,
|
297 |
+
.jstree-default .jstree-animated,
|
298 |
+
.jstree-default .jstree-wholerow {
|
299 |
+
transition: background-color 0.15s, box-shadow 0.15s;
|
300 |
+
}
|
301 |
+
.jstree-default .jstree-hovered {
|
302 |
+
box-shadow: inset 0 0 1px #cccccc;
|
303 |
+
}
|
304 |
+
.jstree-default .jstree-context {
|
305 |
+
background: #e7f4f9;
|
306 |
+
border-radius: 2px;
|
307 |
+
box-shadow: inset 0 0 1px #cccccc;
|
308 |
+
}
|
309 |
+
.jstree-default .jstree-clicked {
|
310 |
+
background: #beebff;
|
311 |
+
border-radius: 2px;
|
312 |
+
box-shadow: inset 0 0 1px #999999;
|
313 |
+
}
|
314 |
+
.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon {
|
315 |
+
display: none;
|
316 |
+
}
|
317 |
+
.jstree-default .jstree-disabled {
|
318 |
+
background: transparent;
|
319 |
+
color: #666666;
|
320 |
+
}
|
321 |
+
.jstree-default .jstree-disabled.jstree-hovered {
|
322 |
+
background: transparent;
|
323 |
+
box-shadow: none;
|
324 |
+
}
|
325 |
+
.jstree-default .jstree-disabled.jstree-clicked {
|
326 |
+
background: #efefef;
|
327 |
+
}
|
328 |
+
.jstree-default .jstree-disabled > .jstree-icon {
|
329 |
+
opacity: 0.8;
|
330 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
331 |
+
/* Firefox 10+ */
|
332 |
+
filter: gray;
|
333 |
+
/* IE6-9 */
|
334 |
+
-webkit-filter: grayscale(100%);
|
335 |
+
/* Chrome 19+ & Safari 6+ */
|
336 |
+
}
|
337 |
+
.jstree-default .jstree-search {
|
338 |
+
font-style: italic;
|
339 |
+
color: #8b0000;
|
340 |
+
font-weight: bold;
|
341 |
+
}
|
342 |
+
.jstree-default .jstree-no-checkboxes .jstree-checkbox {
|
343 |
+
display: none !important;
|
344 |
+
}
|
345 |
+
.jstree-default.jstree-checkbox-no-clicked .jstree-clicked {
|
346 |
+
background: transparent;
|
347 |
+
box-shadow: none;
|
348 |
+
}
|
349 |
+
.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered {
|
350 |
+
background: #e7f4f9;
|
351 |
+
}
|
352 |
+
.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked {
|
353 |
+
background: transparent;
|
354 |
+
}
|
355 |
+
.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered {
|
356 |
+
background: #e7f4f9;
|
357 |
+
}
|
358 |
+
.jstree-default > .jstree-striped {
|
359 |
+
min-width: 100%;
|
360 |
+
display: inline-block;
|
361 |
+
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat;
|
362 |
+
}
|
363 |
+
.jstree-default > .jstree-wholerow-ul .jstree-hovered,
|
364 |
+
.jstree-default > .jstree-wholerow-ul .jstree-clicked {
|
365 |
+
background: transparent;
|
366 |
+
box-shadow: none;
|
367 |
+
border-radius: 0;
|
368 |
+
}
|
369 |
+
.jstree-default .jstree-wholerow {
|
370 |
+
-moz-box-sizing: border-box;
|
371 |
+
-webkit-box-sizing: border-box;
|
372 |
+
box-sizing: border-box;
|
373 |
+
}
|
374 |
+
.jstree-default .jstree-wholerow-hovered {
|
375 |
+
background: #e7f4f9;
|
376 |
+
}
|
377 |
+
.jstree-default .jstree-wholerow-clicked {
|
378 |
+
background: #beebff;
|
379 |
+
background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
|
380 |
+
background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%);
|
381 |
+
}
|
382 |
+
.jstree-default .jstree-node {
|
383 |
+
min-height: 30px;
|
384 |
+
line-height: 30px;
|
385 |
+
margin-left: 24px;
|
386 |
+
min-width: 30px;
|
387 |
+
}
|
388 |
+
.jstree-default .jstree-anchor {
|
389 |
+
line-height: 30px;
|
390 |
+
height: 30px;
|
391 |
+
width: calc(100% - 30px);
|
392 |
+
overflow: hidden;
|
393 |
+
padding: 0 30px 0 6px;
|
394 |
+
box-sizing: border-box;
|
395 |
+
position: relative;
|
396 |
+
margin: 0 0 0 4px;
|
397 |
+
border-radius: 4px;
|
398 |
+
display: inline-block;
|
399 |
+
white-space: nowrap;
|
400 |
+
text-overflow: ellipsis;
|
401 |
+
}
|
402 |
+
.jstree-default .jstree-icon {
|
403 |
+
width: 30px;
|
404 |
+
height: 30px;
|
405 |
+
line-height: 30px;
|
406 |
+
}
|
407 |
+
.jstree-default .jstree-icon:empty {
|
408 |
+
width: 24px;
|
409 |
+
height: 30px;
|
410 |
+
line-height: 30px;
|
411 |
+
}
|
412 |
+
.jstree-default.jstree-rtl .jstree-node {
|
413 |
+
margin-right: 30px;
|
414 |
+
}
|
415 |
+
.jstree-default .jstree-wholerow {
|
416 |
+
height: 30px;
|
417 |
+
}
|
418 |
+
.jstree-default .jstree-node,
|
419 |
+
.jstree-default .jstree-icon {
|
420 |
+
background-image: url("../images/32px.png");
|
421 |
+
}
|
422 |
+
.jstree-default .jstree-node {
|
423 |
+
background-position: -292px -4px;
|
424 |
+
background-repeat: repeat-y;
|
425 |
+
position: relative;
|
426 |
+
}
|
427 |
+
.jstree-default .jstree-last {
|
428 |
+
background: transparent;
|
429 |
+
}
|
430 |
+
.jstree-default .jstree-open > .jstree-ocl {
|
431 |
+
background-position: -132px -2px;
|
432 |
+
}
|
433 |
+
.jstree-default .jstree-closed > .jstree-ocl {
|
434 |
+
background-position: -100px -2px;
|
435 |
+
}
|
436 |
+
.jstree-default .jstree-leaf > .jstree-ocl {
|
437 |
+
background-position: -68px -2px;
|
438 |
+
}
|
439 |
+
.jstree-default .jstree-themeicon {
|
440 |
+
background-position: -260px -2px;
|
441 |
+
background: none;
|
442 |
+
}
|
443 |
+
.jstree-default > .jstree-no-dots .jstree-node,
|
444 |
+
.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
445 |
+
background: transparent;
|
446 |
+
}
|
447 |
+
.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl {
|
448 |
+
background-position: -36px -2px;
|
449 |
+
}
|
450 |
+
.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
451 |
+
background-position: -4px -2px;
|
452 |
+
}
|
453 |
+
.jstree-default .jstree-disabled {
|
454 |
+
background: transparent;
|
455 |
+
}
|
456 |
+
.jstree-default .jstree-disabled.jstree-hovered {
|
457 |
+
background: transparent;
|
458 |
+
}
|
459 |
+
.jstree-default .jstree-disabled.jstree-clicked {
|
460 |
+
background: #efefef;
|
461 |
+
}
|
462 |
+
.jstree-default .jstree-checkbox {
|
463 |
+
background-position: -164px -4px;
|
464 |
+
}
|
465 |
+
.jstree-default .jstree-checkbox:hover {
|
466 |
+
background-position: -164px -36px;
|
467 |
+
}
|
468 |
+
.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
469 |
+
.jstree-default .jstree-checked > .jstree-checkbox {
|
470 |
+
background-position: -228px -4px;
|
471 |
+
}
|
472 |
+
.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
473 |
+
.jstree-default .jstree-checked > .jstree-checkbox:hover {
|
474 |
+
background-position: -228px -36px;
|
475 |
+
}
|
476 |
+
.jstree-default .jstree-anchor > .jstree-undetermined {
|
477 |
+
background-position: -196px -4px;
|
478 |
+
}
|
479 |
+
.jstree-default .jstree-anchor > .jstree-undetermined:hover {
|
480 |
+
background-position: -196px -36px;
|
481 |
+
}
|
482 |
+
.jstree-default .jstree-checkbox-disabled {
|
483 |
+
opacity: 0.8;
|
484 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
485 |
+
/* Firefox 10+ */
|
486 |
+
filter: gray;
|
487 |
+
/* IE6-9 */
|
488 |
+
-webkit-filter: grayscale(100%);
|
489 |
+
/* Chrome 19+ & Safari 6+ */
|
490 |
+
}
|
491 |
+
.jstree-default > .jstree-striped {
|
492 |
+
background-size: auto 48px;
|
493 |
+
}
|
494 |
+
.jstree-default.jstree-rtl .jstree-node {
|
495 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
496 |
+
background-position: 100% 1px;
|
497 |
+
background-repeat: repeat-y;
|
498 |
+
}
|
499 |
+
.jstree-default.jstree-rtl .jstree-last {
|
500 |
+
background: transparent;
|
501 |
+
}
|
502 |
+
.jstree-default.jstree-rtl .jstree-open > .jstree-ocl {
|
503 |
+
background-position: -132px -36px;
|
504 |
+
}
|
505 |
+
.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl {
|
506 |
+
background-position: -100px -36px;
|
507 |
+
}
|
508 |
+
.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl {
|
509 |
+
background-position: -68px -36px;
|
510 |
+
}
|
511 |
+
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node,
|
512 |
+
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
513 |
+
background: transparent;
|
514 |
+
}
|
515 |
+
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
516 |
+
background-position: -36px -36px;
|
517 |
+
}
|
518 |
+
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
519 |
+
background-position: -4px -36px;
|
520 |
+
}
|
521 |
+
.jstree-default .jstree-themeicon-custom {
|
522 |
+
background-color: transparent;
|
523 |
+
background-image: none;
|
524 |
+
background-position: 0 0;
|
525 |
+
}
|
526 |
+
.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
527 |
+
background: url("throbber.gif") center center no-repeat;
|
528 |
+
}
|
529 |
+
.jstree-default .jstree-file {
|
530 |
+
background: url("../images/32px.png") -100px -68px no-repeat;
|
531 |
+
}
|
532 |
+
.jstree-default .jstree-folder {
|
533 |
+
background: url("../images/32px.png") -260px -4px no-repeat;
|
534 |
+
}
|
535 |
+
.jstree-default > .jstree-container-ul > .jstree-node {
|
536 |
+
margin-left: 0;
|
537 |
+
margin-right: 0;
|
538 |
+
}
|
539 |
+
.jstree-default {
|
540 |
+
line-height: 30px;
|
541 |
+
padding: 0 4px;
|
542 |
+
}
|
543 |
+
.jstree-default .jstree-ok,
|
544 |
+
.jstree-default .jstree-er {
|
545 |
+
background-image: url("../images/32px.png");
|
546 |
+
background-repeat: no-repeat;
|
547 |
+
background-color: transparent;
|
548 |
+
}
|
549 |
+
.jstree-default i {
|
550 |
+
background: transparent;
|
551 |
+
width: 20px;
|
552 |
+
height: 30px;
|
553 |
+
line-height: 30px;
|
554 |
+
display: inline-block;
|
555 |
+
vertical-align: top;
|
556 |
+
}
|
557 |
+
.jstree-default .jstree-ok {
|
558 |
+
background-position: -4px -68px;
|
559 |
+
}
|
560 |
+
.jstree-default .jstree-er {
|
561 |
+
background-position: -36px -68px;
|
562 |
+
}
|
563 |
+
.jstree-default .jstree-ellipsis {
|
564 |
+
overflow: hidden;
|
565 |
+
}
|
566 |
+
.jstree-default .jstree-ellipsis .jstree-anchor {
|
567 |
+
width: calc(100% - 29px);
|
568 |
+
text-overflow: ellipsis;
|
569 |
+
overflow: hidden;
|
570 |
+
}
|
571 |
+
.jstree-default.jstree-rtl .jstree-node {
|
572 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
573 |
+
}
|
574 |
+
.jstree-default.jstree-rtl .jstree-last {
|
575 |
+
background: transparent;
|
576 |
+
}
|
577 |
+
.jstree-default-small .jstree-node {
|
578 |
+
min-height: 18px;
|
579 |
+
line-height: 18px;
|
580 |
+
margin-left: 18px;
|
581 |
+
min-width: 18px;
|
582 |
+
}
|
583 |
+
.jstree-default-small .jstree-anchor {
|
584 |
+
line-height: 18px;
|
585 |
+
height: 18px;
|
586 |
+
}
|
587 |
+
.jstree-default-small .jstree-icon {
|
588 |
+
width: 18px;
|
589 |
+
height: 18px;
|
590 |
+
line-height: 18px;
|
591 |
+
}
|
592 |
+
.jstree-default-small .jstree-icon:empty {
|
593 |
+
width: 18px;
|
594 |
+
height: 18px;
|
595 |
+
line-height: 18px;
|
596 |
+
}
|
597 |
+
.jstree-default-small.jstree-rtl .jstree-node {
|
598 |
+
margin-right: 18px;
|
599 |
+
}
|
600 |
+
.jstree-default-small .jstree-wholerow {
|
601 |
+
height: 18px;
|
602 |
+
}
|
603 |
+
.jstree-default-small .jstree-node,
|
604 |
+
.jstree-default-small .jstree-icon {
|
605 |
+
background-image: url("../images/32px.png");
|
606 |
+
}
|
607 |
+
.jstree-default-small .jstree-node {
|
608 |
+
background-position: -295px -7px;
|
609 |
+
background-repeat: repeat-y;
|
610 |
+
}
|
611 |
+
.jstree-default-small .jstree-last {
|
612 |
+
background: transparent;
|
613 |
+
}
|
614 |
+
.jstree-default-small .jstree-open > .jstree-ocl {
|
615 |
+
background-position: -135px -7px;
|
616 |
+
}
|
617 |
+
.jstree-default-small .jstree-closed > .jstree-ocl {
|
618 |
+
background-position: -103px -7px;
|
619 |
+
}
|
620 |
+
.jstree-default-small .jstree-leaf > .jstree-ocl {
|
621 |
+
background-position: -71px -7px;
|
622 |
+
}
|
623 |
+
.jstree-default-small .jstree-themeicon {
|
624 |
+
background-position: -263px -7px;
|
625 |
+
}
|
626 |
+
.jstree-default-small > .jstree-no-dots .jstree-node,
|
627 |
+
.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
628 |
+
background: transparent;
|
629 |
+
}
|
630 |
+
.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl {
|
631 |
+
background-position: -39px -7px;
|
632 |
+
}
|
633 |
+
.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
634 |
+
background-position: -7px -7px;
|
635 |
+
}
|
636 |
+
.jstree-default-small .jstree-disabled {
|
637 |
+
background: transparent;
|
638 |
+
}
|
639 |
+
.jstree-default-small .jstree-disabled.jstree-hovered {
|
640 |
+
background: transparent;
|
641 |
+
}
|
642 |
+
.jstree-default-small .jstree-disabled.jstree-clicked {
|
643 |
+
background: #efefef;
|
644 |
+
}
|
645 |
+
.jstree-default-small .jstree-checkbox {
|
646 |
+
background-position: -167px -7px;
|
647 |
+
}
|
648 |
+
.jstree-default-small .jstree-checkbox:hover {
|
649 |
+
background-position: -167px -39px;
|
650 |
+
}
|
651 |
+
.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
652 |
+
.jstree-default-small .jstree-checked > .jstree-checkbox {
|
653 |
+
background-position: -231px -7px;
|
654 |
+
}
|
655 |
+
.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
656 |
+
.jstree-default-small .jstree-checked > .jstree-checkbox:hover {
|
657 |
+
background-position: -231px -39px;
|
658 |
+
}
|
659 |
+
.jstree-default-small .jstree-anchor > .jstree-undetermined {
|
660 |
+
background-position: -199px -7px;
|
661 |
+
}
|
662 |
+
.jstree-default-small .jstree-anchor > .jstree-undetermined:hover {
|
663 |
+
background-position: -199px -39px;
|
664 |
+
}
|
665 |
+
.jstree-default-small .jstree-checkbox-disabled {
|
666 |
+
opacity: 0.8;
|
667 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
668 |
+
/* Firefox 10+ */
|
669 |
+
filter: gray;
|
670 |
+
/* IE6-9 */
|
671 |
+
-webkit-filter: grayscale(100%);
|
672 |
+
/* Chrome 19+ & Safari 6+ */
|
673 |
+
}
|
674 |
+
.jstree-default-small > .jstree-striped {
|
675 |
+
background-size: auto 36px;
|
676 |
+
}
|
677 |
+
.jstree-default-small.jstree-rtl .jstree-node {
|
678 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
679 |
+
background-position: 100% 1px;
|
680 |
+
background-repeat: repeat-y;
|
681 |
+
}
|
682 |
+
.jstree-default-small.jstree-rtl .jstree-last {
|
683 |
+
background: transparent;
|
684 |
+
}
|
685 |
+
.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl {
|
686 |
+
background-position: -135px -39px;
|
687 |
+
}
|
688 |
+
.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl {
|
689 |
+
background-position: -103px -39px;
|
690 |
+
}
|
691 |
+
.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl {
|
692 |
+
background-position: -71px -39px;
|
693 |
+
}
|
694 |
+
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node,
|
695 |
+
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
696 |
+
background: transparent;
|
697 |
+
}
|
698 |
+
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
699 |
+
background-position: -39px -39px;
|
700 |
+
}
|
701 |
+
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
702 |
+
background-position: -7px -39px;
|
703 |
+
}
|
704 |
+
.jstree-default-small .jstree-themeicon-custom {
|
705 |
+
background-color: transparent;
|
706 |
+
background-image: none;
|
707 |
+
background-position: 0 0;
|
708 |
+
}
|
709 |
+
.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
710 |
+
background: url("throbber.gif") center center no-repeat;
|
711 |
+
}
|
712 |
+
.jstree-default-small .jstree-file {
|
713 |
+
background: url("../images/32px.png") -103px -71px no-repeat;
|
714 |
+
}
|
715 |
+
.jstree-default-small .jstree-folder {
|
716 |
+
background: url("../images/32px.png") -263px -7px no-repeat;
|
717 |
+
}
|
718 |
+
.jstree-default-small > .jstree-container-ul > .jstree-node {
|
719 |
+
margin-left: 0;
|
720 |
+
margin-right: 0;
|
721 |
+
}
|
722 |
+
.jstree-default-small {
|
723 |
+
line-height: 18px;
|
724 |
+
padding: 0 4px;
|
725 |
+
}
|
726 |
+
.jstree-default-small .jstree-ok,
|
727 |
+
.jstree-default-small .jstree-er {
|
728 |
+
background-image: url("../images/32px.png");
|
729 |
+
background-repeat: no-repeat;
|
730 |
+
background-color: transparent;
|
731 |
+
}
|
732 |
+
.jstree-default-small i {
|
733 |
+
background: transparent;
|
734 |
+
width: 18px;
|
735 |
+
height: 18px;
|
736 |
+
line-height: 18px;
|
737 |
+
}
|
738 |
+
.jstree-default-small .jstree-ok {
|
739 |
+
background-position: -7px -71px;
|
740 |
+
}
|
741 |
+
.jstree-default-small .jstree-er {
|
742 |
+
background-position: -39px -71px;
|
743 |
+
}
|
744 |
+
.jstree-default-small .jstree-ellipsis {
|
745 |
+
overflow: hidden;
|
746 |
+
}
|
747 |
+
.jstree-default-small .jstree-ellipsis .jstree-anchor {
|
748 |
+
width: calc(100% - 23px);
|
749 |
+
text-overflow: ellipsis;
|
750 |
+
overflow: hidden;
|
751 |
+
}
|
752 |
+
.jstree-default-small.jstree-rtl .jstree-node {
|
753 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==");
|
754 |
+
}
|
755 |
+
.jstree-default-small.jstree-rtl .jstree-last {
|
756 |
+
background: transparent;
|
757 |
+
}
|
758 |
+
.jstree-default-large .jstree-node {
|
759 |
+
min-height: 32px;
|
760 |
+
line-height: 32px;
|
761 |
+
margin-left: 32px;
|
762 |
+
min-width: 32px;
|
763 |
+
}
|
764 |
+
.jstree-default-large .jstree-anchor {
|
765 |
+
line-height: 32px;
|
766 |
+
height: 32px;
|
767 |
+
}
|
768 |
+
.jstree-default-large .jstree-icon {
|
769 |
+
width: 32px;
|
770 |
+
height: 32px;
|
771 |
+
line-height: 32px;
|
772 |
+
}
|
773 |
+
.jstree-default-large .jstree-icon:empty {
|
774 |
+
width: 32px;
|
775 |
+
height: 32px;
|
776 |
+
line-height: 32px;
|
777 |
+
}
|
778 |
+
.jstree-default-large.jstree-rtl .jstree-node {
|
779 |
+
margin-right: 32px;
|
780 |
+
}
|
781 |
+
.jstree-default-large .jstree-wholerow {
|
782 |
+
height: 32px;
|
783 |
+
}
|
784 |
+
.jstree-default-large .jstree-node,
|
785 |
+
.jstree-default-large .jstree-icon {
|
786 |
+
background-image: url("../images/32px.png");
|
787 |
+
}
|
788 |
+
.jstree-default-large .jstree-node {
|
789 |
+
background-position: -288px 0px;
|
790 |
+
background-repeat: repeat-y;
|
791 |
+
}
|
792 |
+
.jstree-default-large .jstree-last {
|
793 |
+
background: transparent;
|
794 |
+
}
|
795 |
+
.jstree-default-large .jstree-open > .jstree-ocl {
|
796 |
+
background-position: -128px 0px;
|
797 |
+
}
|
798 |
+
.jstree-default-large .jstree-closed > .jstree-ocl {
|
799 |
+
background-position: -96px 0px;
|
800 |
+
}
|
801 |
+
.jstree-default-large .jstree-leaf > .jstree-ocl {
|
802 |
+
background-position: -64px 0px;
|
803 |
+
}
|
804 |
+
.jstree-default-large .jstree-themeicon {
|
805 |
+
background-position: -256px 0px;
|
806 |
+
}
|
807 |
+
.jstree-default-large > .jstree-no-dots .jstree-node,
|
808 |
+
.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
809 |
+
background: transparent;
|
810 |
+
}
|
811 |
+
.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl {
|
812 |
+
background-position: -32px 0px;
|
813 |
+
}
|
814 |
+
.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
815 |
+
background-position: 0px 0px;
|
816 |
+
}
|
817 |
+
.jstree-default-large .jstree-disabled {
|
818 |
+
background: transparent;
|
819 |
+
}
|
820 |
+
.jstree-default-large .jstree-disabled.jstree-hovered {
|
821 |
+
background: transparent;
|
822 |
+
}
|
823 |
+
.jstree-default-large .jstree-disabled.jstree-clicked {
|
824 |
+
background: #efefef;
|
825 |
+
}
|
826 |
+
.jstree-default-large .jstree-checkbox {
|
827 |
+
background-position: -160px 0px;
|
828 |
+
}
|
829 |
+
.jstree-default-large .jstree-checkbox:hover {
|
830 |
+
background-position: -160px -32px;
|
831 |
+
}
|
832 |
+
.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
833 |
+
.jstree-default-large .jstree-checked > .jstree-checkbox {
|
834 |
+
background-position: -224px 0px;
|
835 |
+
}
|
836 |
+
.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
837 |
+
.jstree-default-large .jstree-checked > .jstree-checkbox:hover {
|
838 |
+
background-position: -224px -32px;
|
839 |
+
}
|
840 |
+
.jstree-default-large .jstree-anchor > .jstree-undetermined {
|
841 |
+
background-position: -192px 0px;
|
842 |
+
}
|
843 |
+
.jstree-default-large .jstree-anchor > .jstree-undetermined:hover {
|
844 |
+
background-position: -192px -32px;
|
845 |
+
}
|
846 |
+
.jstree-default-large .jstree-checkbox-disabled {
|
847 |
+
opacity: 0.8;
|
848 |
+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
|
849 |
+
/* Firefox 10+ */
|
850 |
+
filter: gray;
|
851 |
+
/* IE6-9 */
|
852 |
+
-webkit-filter: grayscale(100%);
|
853 |
+
/* Chrome 19+ & Safari 6+ */
|
854 |
+
}
|
855 |
+
.jstree-default-large > .jstree-striped {
|
856 |
+
background-size: auto 64px;
|
857 |
+
}
|
858 |
+
.jstree-default-large.jstree-rtl .jstree-node {
|
859 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
|
860 |
+
background-position: 100% 1px;
|
861 |
+
background-repeat: repeat-y;
|
862 |
+
}
|
863 |
+
.jstree-default-large.jstree-rtl .jstree-last {
|
864 |
+
background: transparent;
|
865 |
+
}
|
866 |
+
.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl {
|
867 |
+
background-position: -128px -32px;
|
868 |
+
}
|
869 |
+
.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl {
|
870 |
+
background-position: -96px -32px;
|
871 |
+
}
|
872 |
+
.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl {
|
873 |
+
background-position: -64px -32px;
|
874 |
+
}
|
875 |
+
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node,
|
876 |
+
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
|
877 |
+
background: transparent;
|
878 |
+
}
|
879 |
+
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
|
880 |
+
background-position: -32px -32px;
|
881 |
+
}
|
882 |
+
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
|
883 |
+
background-position: 0px -32px;
|
884 |
+
}
|
885 |
+
.jstree-default-large .jstree-themeicon-custom {
|
886 |
+
background-color: transparent;
|
887 |
+
background-image: none;
|
888 |
+
background-position: 0 0;
|
889 |
+
}
|
890 |
+
.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl {
|
891 |
+
background: url("throbber.gif") center center no-repeat;
|
892 |
+
}
|
893 |
+
.jstree-default-large .jstree-file {
|
894 |
+
background: url("../images/32px.png") -96px -64px no-repeat;
|
895 |
+
}
|
896 |
+
.jstree-default-large .jstree-folder {
|
897 |
+
background: url("../images/32px.png") -256px 0px no-repeat;
|
898 |
+
}
|
899 |
+
.jstree-default-large > .jstree-container-ul > .jstree-node {
|
900 |
+
margin-left: 0;
|
901 |
+
margin-right: 0;
|
902 |
+
}
|
903 |
+
.jstree-default-large {
|
904 |
+
line-height: 32px;
|
905 |
+
padding: 0 4px;
|
906 |
+
}
|
907 |
+
.jstree-default-large .jstree-ok,
|
908 |
+
.jstree-default-large .jstree-er {
|
909 |
+
background-image: url("../images/32px.png");
|
910 |
+
background-repeat: no-repeat;
|
911 |
+
background-color: transparent;
|
912 |
+
}
|
913 |
+
.jstree-default-large i {
|
914 |
+
background: transparent;
|
915 |
+
width: 32px;
|
916 |
+
height: 32px;
|
917 |
+
line-height: 32px;
|
918 |
+
}
|
919 |
+
.jstree-default-large .jstree-ok {
|
920 |
+
background-position: 0px -64px;
|
921 |
+
}
|
922 |
+
.jstree-default-large .jstree-er {
|
923 |
+
background-position: -32px -64px;
|
924 |
+
}
|
925 |
+
.jstree-default-large .jstree-ellipsis {
|
926 |
+
overflow: hidden;
|
927 |
+
}
|
928 |
+
.jstree-default-large .jstree-ellipsis .jstree-anchor {
|
929 |
+
width: calc(100% - 37px);
|
930 |
+
text-overflow: ellipsis;
|
931 |
+
overflow: hidden;
|
932 |
+
}
|
933 |
+
.jstree-default-large.jstree-rtl .jstree-node {
|
934 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==");
|
935 |
+
}
|
936 |
+
.jstree-default-large.jstree-rtl .jstree-last {
|
937 |
+
background: transparent;
|
938 |
+
}
|
939 |
+
@media (max-width: 768px) {
|
940 |
+
.jstree-dnd-responsive {
|
941 |
+
line-height: 40px;
|
942 |
+
font-weight: bold;
|
943 |
+
font-size: 1.1em;
|
944 |
+
text-shadow: 1px 1px white;
|
945 |
+
}
|
946 |
+
.jstree-dnd-responsive > i {
|
947 |
+
background: transparent;
|
948 |
+
width: 40px;
|
949 |
+
height: 40px;
|
950 |
+
}
|
951 |
+
.jstree-dnd-responsive > .jstree-ok {
|
952 |
+
background-image: url("../images/40px.png");
|
953 |
+
background-position: 0 -200px;
|
954 |
+
background-size: 120px 240px;
|
955 |
+
}
|
956 |
+
.jstree-dnd-responsive > .jstree-er {
|
957 |
+
background-image: url("../images/40px.png");
|
958 |
+
background-position: -40px -200px;
|
959 |
+
background-size: 120px 240px;
|
960 |
+
}
|
961 |
+
#jstree-marker.jstree-dnd-responsive {
|
962 |
+
border-left-width: 10px;
|
963 |
+
border-top-width: 10px;
|
964 |
+
border-bottom-width: 10px;
|
965 |
+
margin-top: -10px;
|
966 |
+
}
|
967 |
+
}
|
968 |
+
@media (max-width: 768px) {
|
969 |
+
.jstree-default-responsive {
|
970 |
+
/*
|
971 |
+
.jstree-open > .jstree-ocl,
|
972 |
+
.jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; }
|
973 |
+
*/
|
974 |
+
}
|
975 |
+
.jstree-default-responsive .jstree-icon {
|
976 |
+
background-image: url("../images/40px.png");
|
977 |
+
}
|
978 |
+
.jstree-default-responsive .jstree-node,
|
979 |
+
.jstree-default-responsive .jstree-leaf > .jstree-ocl {
|
980 |
+
background: transparent;
|
981 |
+
}
|
982 |
+
.jstree-default-responsive .jstree-node {
|
983 |
+
min-height: 40px;
|
984 |
+
line-height: 40px;
|
985 |
+
margin-left: 40px;
|
986 |
+
min-width: 40px;
|
987 |
+
white-space: nowrap;
|
988 |
+
}
|
989 |
+
.jstree-default-responsive .jstree-anchor {
|
990 |
+
line-height: 40px;
|
991 |
+
height: 40px;
|
992 |
+
}
|
993 |
+
.jstree-default-responsive .jstree-icon,
|
994 |
+
.jstree-default-responsive .jstree-icon:empty {
|
995 |
+
width: 40px;
|
996 |
+
height: 40px;
|
997 |
+
line-height: 40px;
|
998 |
+
}
|
999 |
+
.jstree-default-responsive > .jstree-container-ul > .jstree-node {
|
1000 |
+
margin-left: 0;
|
1001 |
+
}
|
1002 |
+
.jstree-default-responsive.jstree-rtl .jstree-node {
|
1003 |
+
margin-left: 0;
|
1004 |
+
margin-right: 40px;
|
1005 |
+
background: transparent;
|
1006 |
+
}
|
1007 |
+
.jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node {
|
1008 |
+
margin-right: 0;
|
1009 |
+
}
|
1010 |
+
.jstree-default-responsive .jstree-ocl,
|
1011 |
+
.jstree-default-responsive .jstree-themeicon,
|
1012 |
+
.jstree-default-responsive .jstree-checkbox {
|
1013 |
+
background-size: 120px 240px;
|
1014 |
+
}
|
1015 |
+
.jstree-default-responsive .jstree-leaf > .jstree-ocl,
|
1016 |
+
.jstree-default-responsive.jstree-rtl .jstree-leaf > .jstree-ocl {
|
1017 |
+
background: transparent;
|
1018 |
+
}
|
1019 |
+
.jstree-default-responsive .jstree-open > .jstree-ocl {
|
1020 |
+
background-position: 0 0 !important;
|
1021 |
+
}
|
1022 |
+
.jstree-default-responsive .jstree-closed > .jstree-ocl {
|
1023 |
+
background-position: 0 -40px !important;
|
1024 |
+
}
|
1025 |
+
.jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl {
|
1026 |
+
background-position: -40px 0 !important;
|
1027 |
+
}
|
1028 |
+
.jstree-default-responsive .jstree-themeicon {
|
1029 |
+
background-position: -40px -40px;
|
1030 |
+
}
|
1031 |
+
.jstree-default-responsive .jstree-checkbox,
|
1032 |
+
.jstree-default-responsive .jstree-checkbox:hover {
|
1033 |
+
background-position: -40px -80px;
|
1034 |
+
}
|
1035 |
+
.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,
|
1036 |
+
.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,
|
1037 |
+
.jstree-default-responsive .jstree-checked > .jstree-checkbox,
|
1038 |
+
.jstree-default-responsive .jstree-checked > .jstree-checkbox:hover {
|
1039 |
+
background-position: 0 -80px;
|
1040 |
+
}
|
1041 |
+
.jstree-default-responsive .jstree-anchor > .jstree-undetermined,
|
1042 |
+
.jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover {
|
1043 |
+
background-position: 0 -120px;
|
1044 |
+
}
|
1045 |
+
.jstree-default-responsive .jstree-anchor {
|
1046 |
+
font-weight: bold;
|
1047 |
+
font-size: 1.1em;
|
1048 |
+
text-shadow: 1px 1px white;
|
1049 |
+
}
|
1050 |
+
.jstree-default-responsive > .jstree-striped {
|
1051 |
+
background: transparent;
|
1052 |
+
}
|
1053 |
+
.jstree-default-responsive .jstree-wholerow {
|
1054 |
+
border-top: 1px solid rgba(255, 255, 255, 0.7);
|
1055 |
+
border-bottom: 1px solid rgba(64, 64, 64, 0.2);
|
1056 |
+
background: #ebebeb;
|
1057 |
+
height: 40px;
|
1058 |
+
}
|
1059 |
+
.jstree-default-responsive .jstree-wholerow-hovered {
|
1060 |
+
background: #e7f4f9;
|
1061 |
+
}
|
1062 |
+
.jstree-default-responsive .jstree-wholerow-clicked {
|
1063 |
+
background: #beebff;
|
1064 |
+
}
|
1065 |
+
.jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow {
|
1066 |
+
box-shadow: inset 0 -6px 3px -5px #666666;
|
1067 |
+
}
|
1068 |
+
.jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow {
|
1069 |
+
box-shadow: inset 0 6px 3px -5px #666666;
|
1070 |
+
border-top: 0;
|
1071 |
+
}
|
1072 |
+
.jstree-default-responsive .jstree-children .jstree-open + .jstree-open {
|
1073 |
+
box-shadow: none;
|
1074 |
+
}
|
1075 |
+
.jstree-default-responsive .jstree-node,
|
1076 |
+
.jstree-default-responsive .jstree-icon,
|
1077 |
+
.jstree-default-responsive .jstree-node > .jstree-ocl,
|
1078 |
+
.jstree-default-responsive .jstree-themeicon,
|
1079 |
+
.jstree-default-responsive .jstree-checkbox {
|
1080 |
+
background-image: url("../images/40px.png");
|
1081 |
+
background-size: 120px 240px;
|
1082 |
+
}
|
1083 |
+
.jstree-default-responsive .jstree-node {
|
1084 |
+
background-position: -80px 0;
|
1085 |
+
background-repeat: repeat-y;
|
1086 |
+
}
|
1087 |
+
.jstree-default-responsive .jstree-last {
|
1088 |
+
background: transparent;
|
1089 |
+
}
|
1090 |
+
.jstree-default-responsive .jstree-leaf > .jstree-ocl {
|
1091 |
+
background-position: -40px -120px;
|
1092 |
+
}
|
1093 |
+
.jstree-default-responsive .jstree-last > .jstree-ocl {
|
1094 |
+
background-position: -40px -160px;
|
1095 |
+
}
|
1096 |
+
.jstree-default-responsive .jstree-themeicon-custom {
|
1097 |
+
background-color: transparent;
|
1098 |
+
background-image: none;
|
1099 |
+
background-position: 0 0;
|
1100 |
+
}
|
1101 |
+
.jstree-default-responsive .jstree-file {
|
1102 |
+
background: url("../images/40px.png") 0 -160px no-repeat;
|
1103 |
+
background-size: 120px 240px;
|
1104 |
+
}
|
1105 |
+
.jstree-default-responsive .jstree-folder {
|
1106 |
+
background: url("../images/40px.png") -40px -40px no-repeat;
|
1107 |
+
background-size: 120px 240px;
|
1108 |
+
}
|
1109 |
+
.jstree-default-responsive > .jstree-container-ul > .jstree-node {
|
1110 |
+
margin-left: 0;
|
1111 |
+
margin-right: 0;
|
1112 |
+
}
|
1113 |
+
}
|
assets/css/jstree.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.jstree-children,.jstree-container-ul,.jstree-node{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:#000;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:active,.jstree-anchor:hover,.jstree-anchor:link,.jstree-anchor:visited{text-decoration:none}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-anchor>.jstree-themeicon-hidden,.jstree-no-icons .jstree-themeicon{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jstree-contextmenu .jstree-anchor{-webkit-user-select:none;-webkit-touch-callout:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em 0 2em;text-decoration:none;width:auto;color:#000;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 #fff;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url(data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==);background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:#fff;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context .vakata-contextmenu-disabled>a>i{filter:grayscale(100%)}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:0 0;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:#fff;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url(data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7);background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:#fff;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}.jstree-copy,.jstree-icon{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}.jstree-ok{background:green}.jstree-er{background:red}.jstree-copy{margin:0 2px 0 2px}.jstree-default .jstree-icon,.jstree-default .jstree-node{background-repeat:no-repeat;background-color:transparent}.jstree-default .jstree-anchor,.jstree-default .jstree-animated,.jstree-default .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default .jstree-hovered{box-shadow:inset 0 0 1px #ccc}.jstree-default .jstree-context{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #ccc}.jstree-default .jstree-clicked{background:#beebff;border-radius:2px;box-shadow:inset 0 0 1px #999}.jstree-default .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default .jstree-disabled{background:0 0;color:#666}.jstree-default .jstree-disabled.jstree-hovered{background:0 0;box-shadow:none}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default .jstree-search{font-style:italic;color:#8b0000;font-weight:700}.jstree-default .jstree-no-checkboxes .jstree-checkbox{display:none!important}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked{background:0 0;box-shadow:none}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#e7f4f9}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:0 0}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#e7f4f9}.jstree-default>.jstree-striped{min-width:100%;display:inline-block;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==) left top repeat}.jstree-default>.jstree-wholerow-ul .jstree-clicked,.jstree-default>.jstree-wholerow-ul .jstree-hovered{background:0 0;box-shadow:none;border-radius:0}.jstree-default .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default .jstree-wholerow-hovered{background:#e7f4f9}.jstree-default .jstree-wholerow-clicked{background:#beebff;background:-webkit-linear-gradient(top,#beebff 0,#a8e4ff 100%);background:linear-gradient(to bottom,#beebff 0,#a8e4ff 100%)}.jstree-default .jstree-node{min-height:30px;line-height:30px;margin-left:24px;min-width:30px}.jstree-default .jstree-anchor{line-height:30px;height:30px;width:calc(100% - 30px);overflow:hidden;padding:0 30px 0 6px;box-sizing:border-box;position:relative;margin:0 0 0 4px;border-radius:4px;display:inline-block;white-space:nowrap;text-overflow:ellipsis}.jstree-default .jstree-icon{width:30px;height:30px;line-height:30px}.jstree-default .jstree-icon:empty{width:24px;height:30px;line-height:30px}.jstree-default.jstree-rtl .jstree-node{margin-right:30px}.jstree-default .jstree-wholerow{height:30px}.jstree-default .jstree-icon,.jstree-default .jstree-node{background-image:url(../images/32px.png)}.jstree-default .jstree-node{background-position:-292px -4px;background-repeat:repeat-y;position:relative}.jstree-default .jstree-last{background:0 0}.jstree-default .jstree-open>.jstree-ocl{background-position:-132px -2px}.jstree-default .jstree-closed>.jstree-ocl{background-position:-100px -2px}.jstree-default .jstree-leaf>.jstree-ocl{background-position:-68px -2px}.jstree-default .jstree-themeicon{background-position:-260px -2px;background:0 0}.jstree-default>.jstree-no-dots .jstree-leaf>.jstree-ocl,.jstree-default>.jstree-no-dots .jstree-node{background:0 0}.jstree-default>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -2px}.jstree-default>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -2px}.jstree-default .jstree-disabled{background:0 0}.jstree-default .jstree-disabled.jstree-hovered{background:0 0}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-checkbox{background-position:-164px -4px}.jstree-default .jstree-checkbox:hover{background-position:-164px -36px}.jstree-default .jstree-checked>.jstree-checkbox,.jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox{background-position:-228px -4px}.jstree-default .jstree-checked>.jstree-checkbox:hover,.jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover{background-position:-228px -36px}.jstree-default .jstree-anchor>.jstree-undetermined{background-position:-196px -4px}.jstree-default .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px}.jstree-default .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default>.jstree-striped{background-size:auto 48px}.jstree-default.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-default.jstree-rtl .jstree-last{background:0 0}.jstree-default.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px}.jstree-default.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px}.jstree-default.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl,.jstree-default.jstree-rtl>.jstree-no-dots .jstree-node{background:0 0}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px}.jstree-default.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px}.jstree-default .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-default .jstree-file{background:url(../images/32px.png) -100px -68px no-repeat}.jstree-default .jstree-folder{background:url(../images/32px.png) -260px -4px no-repeat}.jstree-default>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}.jstree-default{line-height:30px;padding:0 4px}.jstree-default .jstree-er,.jstree-default .jstree-ok{background-image:url(../images/32px.png);background-repeat:no-repeat;background-color:transparent}.jstree-default i{background:0 0;width:20px;height:30px;line-height:30px;display:inline-block;vertical-align:top}.jstree-default .jstree-ok{background-position:-4px -68px}.jstree-default .jstree-er{background-position:-36px -68px}.jstree-default .jstree-ellipsis{overflow:hidden}.jstree-default .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden}.jstree-default.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==)}.jstree-default.jstree-rtl .jstree-last{background:0 0}.jstree-default-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-default-small .jstree-anchor{line-height:18px;height:18px}.jstree-default-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-default-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-default-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-default-small .jstree-wholerow{height:18px}.jstree-default-small .jstree-icon,.jstree-default-small .jstree-node{background-image:url(../images/32px.png)}.jstree-default-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-default-small .jstree-last{background:0 0}.jstree-default-small .jstree-open>.jstree-ocl{background-position:-135px -7px}.jstree-default-small .jstree-closed>.jstree-ocl{background-position:-103px -7px}.jstree-default-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px}.jstree-default-small .jstree-themeicon{background-position:-263px -7px}.jstree-default-small>.jstree-no-dots .jstree-leaf>.jstree-ocl,.jstree-default-small>.jstree-no-dots .jstree-node{background:0 0}.jstree-default-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px}.jstree-default-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px}.jstree-default-small .jstree-disabled{background:0 0}.jstree-default-small .jstree-disabled.jstree-hovered{background:0 0}.jstree-default-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-small .jstree-checkbox{background-position:-167px -7px}.jstree-default-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-default-small .jstree-checked>.jstree-checkbox,.jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox{background-position:-231px -7px}.jstree-default-small .jstree-checked>.jstree-checkbox:hover,.jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover{background-position:-231px -39px}.jstree-default-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px}.jstree-default-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px}.jstree-default-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-small>.jstree-striped{background-size:auto 36px}.jstree-default-small.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-default-small.jstree-rtl .jstree-last{background:0 0}.jstree-default-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px}.jstree-default-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px}.jstree-default-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl,.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-node{background:0 0}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px}.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px}.jstree-default-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-default-small .jstree-file{background:url(../images/32px.png) -103px -71px no-repeat}.jstree-default-small .jstree-folder{background:url(../images/32px.png) -263px -7px no-repeat}.jstree-default-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}.jstree-default-small{line-height:18px;padding:0 4px}.jstree-default-small .jstree-er,.jstree-default-small .jstree-ok{background-image:url(../images/32px.png);background-repeat:no-repeat;background-color:transparent}.jstree-default-small i{background:0 0;width:18px;height:18px;line-height:18px}.jstree-default-small .jstree-ok{background-position:-7px -71px}.jstree-default-small .jstree-er{background-position:-39px -71px}.jstree-default-small .jstree-ellipsis{overflow:hidden}.jstree-default-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden}.jstree-default-small.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==)}.jstree-default-small.jstree-rtl .jstree-last{background:0 0}.jstree-default-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-default-large .jstree-anchor{line-height:32px;height:32px}.jstree-default-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-default-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-default-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-default-large .jstree-wholerow{height:32px}.jstree-default-large .jstree-icon,.jstree-default-large .jstree-node{background-image:url(../images/32px.png)}.jstree-default-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y}.jstree-default-large .jstree-last{background:0 0}.jstree-default-large .jstree-open>.jstree-ocl{background-position:-128px 0}.jstree-default-large .jstree-closed>.jstree-ocl{background-position:-96px 0}.jstree-default-large .jstree-leaf>.jstree-ocl{background-position:-64px 0}.jstree-default-large .jstree-themeicon{background-position:-256px 0}.jstree-default-large>.jstree-no-dots .jstree-leaf>.jstree-ocl,.jstree-default-large>.jstree-no-dots .jstree-node{background:0 0}.jstree-default-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0}.jstree-default-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0}.jstree-default-large .jstree-disabled{background:0 0}.jstree-default-large .jstree-disabled.jstree-hovered{background:0 0}.jstree-default-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default-large .jstree-checkbox{background-position:-160px 0}.jstree-default-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-default-large .jstree-checked>.jstree-checkbox,.jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox{background-position:-224px 0}.jstree-default-large .jstree-checked>.jstree-checkbox:hover,.jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover{background-position:-224px -32px}.jstree-default-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0}.jstree-default-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px}.jstree-default-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-large>.jstree-striped{background-size:auto 64px}.jstree-default-large.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==);background-position:100% 1px;background-repeat:repeat-y}.jstree-default-large.jstree-rtl .jstree-last{background:0 0}.jstree-default-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px}.jstree-default-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px}.jstree-default-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl,.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-node{background:0 0}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px}.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px}.jstree-default-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url(throbber.gif) center center no-repeat}.jstree-default-large .jstree-file{background:url(../images/32px.png) -96px -64px no-repeat}.jstree-default-large .jstree-folder{background:url(../images/32px.png) -256px 0 no-repeat}.jstree-default-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}.jstree-default-large{line-height:32px;padding:0 4px}.jstree-default-large .jstree-er,.jstree-default-large .jstree-ok{background-image:url(../images/32px.png);background-repeat:no-repeat;background-color:transparent}.jstree-default-large i{background:0 0;width:32px;height:32px;line-height:32px}.jstree-default-large .jstree-ok{background-position:0 -64px}.jstree-default-large .jstree-er{background-position:-32px -64px}.jstree-default-large .jstree-ellipsis{overflow:hidden}.jstree-default-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden}.jstree-default-large.jstree-rtl .jstree-node{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==)}.jstree-default-large.jstree-rtl .jstree-last{background:0 0}@media (max-width:768px){.jstree-dnd-responsive{line-height:40px;font-weight:700;font-size:1.1em;text-shadow:1px 1px #fff}.jstree-dnd-responsive>i{background:0 0;width:40px;height:40px}.jstree-dnd-responsive>.jstree-ok{background-image:url(../images/40px.png);background-position:0 -200px;background-size:120px 240px}.jstree-dnd-responsive>.jstree-er{background-image:url(../images/40px.png);background-position:-40px -200px;background-size:120px 240px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-responsive .jstree-icon{background-image:url(../images/40px.png)}.jstree-default-responsive .jstree-leaf>.jstree-ocl,.jstree-default-responsive .jstree-node{background:0 0}.jstree-default-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap}.jstree-default-responsive .jstree-anchor{line-height:40px;height:40px}.jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px}.jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0}.jstree-default-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:0 0}.jstree-default-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-default-responsive .jstree-checkbox,.jstree-default-responsive .jstree-ocl,.jstree-default-responsive .jstree-themeicon{background-size:120px 240px}.jstree-default-responsive .jstree-leaf>.jstree-ocl,.jstree-default-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:0 0}.jstree-default-responsive .jstree-open>.jstree-ocl{background-position:0 0!important}.jstree-default-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px!important}.jstree-default-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0!important}.jstree-default-responsive .jstree-themeicon{background-position:-40px -40px}.jstree-default-responsive .jstree-checkbox,.jstree-default-responsive .jstree-checkbox:hover{background-position:-40px -80px}.jstree-default-responsive .jstree-checked>.jstree-checkbox,.jstree-default-responsive .jstree-checked>.jstree-checkbox:hover,.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover{background-position:0 -80px}.jstree-default-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px}.jstree-default-responsive .jstree-anchor{font-weight:700;font-size:1.1em;text-shadow:1px 1px #fff}.jstree-default-responsive>.jstree-striped{background:0 0}.jstree-default-responsive .jstree-wholerow{border-top:1px solid rgba(255,255,255,.7);border-bottom:1px solid rgba(64,64,64,.2);background:#ebebeb;height:40px}.jstree-default-responsive .jstree-wholerow-hovered{background:#e7f4f9}.jstree-default-responsive .jstree-wholerow-clicked{background:#beebff}.jstree-default-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #666}.jstree-default-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #666;border-top:0}.jstree-default-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none}.jstree-default-responsive .jstree-checkbox,.jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-node,.jstree-default-responsive .jstree-node>.jstree-ocl,.jstree-default-responsive .jstree-themeicon{background-image:url(../images/40px.png);background-size:120px 240px}.jstree-default-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y}.jstree-default-responsive .jstree-last{background:0 0}.jstree-default-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px}.jstree-default-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px}.jstree-default-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-default-responsive .jstree-file{background:url(../images/40px.png) 0 -160px no-repeat;background-size:120px 240px}.jstree-default-responsive .jstree-folder{background:url(../images/40px.png) -40px -40px no-repeat;background-size:120px 240px}.jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}}
|
assets/css/page-post-media.css
CHANGED
@@ -56,7 +56,7 @@ span.create_new_folder {
|
|
56 |
backdrop-filter: blur(16px);
|
57 |
border-radius: 4px;
|
58 |
text-align: center;
|
59 |
-
margin: 0
|
60 |
}
|
61 |
|
62 |
span.folder-loader-ajax {
|
@@ -408,20 +408,11 @@ span.total-count {
|
|
408 |
outline: 0;
|
409 |
box-shadow: none
|
410 |
}
|
411 |
-
|
412 |
-
.sticky-folders {
|
413 |
-
display: none;
|
414 |
-
padding: 0 0 5px;
|
415 |
-
margin: 0 0 5px;
|
416 |
-
border-bottom: solid 1px #ccc
|
417 |
-
}
|
418 |
-
|
419 |
.sticky-title {
|
420 |
font-size: 16px;
|
421 |
font-weight: 700;
|
422 |
padding: 7px
|
423 |
}
|
424 |
-
|
425 |
div#custom-menu {
|
426 |
padding: 10px;
|
427 |
background: #fff;
|
@@ -524,36 +515,9 @@ div#custom-menu {
|
|
524 |
text-align: left
|
525 |
}
|
526 |
|
527 |
-
.sticky-folders li a span.update-inline-record, .wcp-container .route span.update-inline-record {
|
528 |
-
position: relative;
|
529 |
-
left: auto;
|
530 |
-
top: 0;
|
531 |
-
float: right;
|
532 |
-
width: 0;
|
533 |
-
height: 30px;
|
534 |
-
font-size: 16px;
|
535 |
-
overflow: hidden;
|
536 |
-
transition: all .25s linear;
|
537 |
-
-webkit-transition: all .25s linear;
|
538 |
-
-moz-transition: all .25s linear;
|
539 |
-
line-height: 30px
|
540 |
-
}
|
541 |
-
|
542 |
#custom-menu [class*=" pfolder-"], #custom-menu [class^=pfolder-] {
|
543 |
font-size: 12px
|
544 |
}
|
545 |
-
|
546 |
-
.sticky-folders li a span.star-icon, .wcp-container .route span.star-icon {
|
547 |
-
position: relative;
|
548 |
-
top: 2px;
|
549 |
-
left: auto;
|
550 |
-
float: right;
|
551 |
-
speak: none;
|
552 |
-
color: #ffc90e;
|
553 |
-
display: none;
|
554 |
-
font-size: 14px
|
555 |
-
}
|
556 |
-
|
557 |
.wcp-container .route .title .folder-sticky-icon, .wcp-container .route .title .move-folder-icon {
|
558 |
float: right;
|
559 |
position: relative;
|
@@ -565,15 +529,8 @@ div#custom-menu {
|
|
565 |
display: none
|
566 |
}
|
567 |
|
568 |
-
.wcp-container .route .title .folder-sticky-icon, .wcp-container .route .title .move-folder-icon {
|
569 |
-
|
570 |
-
position: relative;
|
571 |
-
top: 0;
|
572 |
-
left: auto;
|
573 |
-
width: 20px;
|
574 |
-
height: 30px;
|
575 |
-
line-height: 26px;
|
576 |
-
display: none
|
577 |
}
|
578 |
|
579 |
.nav-icon {
|
@@ -657,7 +614,7 @@ body:not(.no-hover-css) .wcp-container .route .title:hover .ui-icon .pfolder-fol
|
|
657 |
.dynamic-menu li {
|
658 |
position: relative;
|
659 |
width: 100%;
|
660 |
-
display:
|
661 |
padding: 2px 0;
|
662 |
margin: 0
|
663 |
}
|
@@ -763,7 +720,7 @@ li.active-menu {
|
|
763 |
font-size: 14px;
|
764 |
padding: 0 0 0 15px;
|
765 |
display: block;
|
766 |
-
width: 100
|
767 |
border-radius: 4px;
|
768 |
border: 1px solid #484848;
|
769 |
height: 34px;
|
@@ -1126,4 +1083,10 @@ html[dir=rtl] .media-frame.mode-select.hide-router .media-frame-title, html[dir=
|
|
1126 |
html[dir=rtl] .media-frame.hide-menu .media-frame-content, html[dir=rtl] .media-frame.hide-menu .media-frame-router, html[dir=rtl] .media-frame.hide-menu .media-frame-title, html[dir=rtl] .media-frame.hide-menu .media-frame-toolbar {
|
1127 |
left: 0;
|
1128 |
right: 275px;
|
|
|
|
|
|
|
|
|
|
|
|
|
1129 |
}
|
56 |
backdrop-filter: blur(16px);
|
57 |
border-radius: 4px;
|
58 |
text-align: center;
|
59 |
+
margin: 0 15px 0 0
|
60 |
}
|
61 |
|
62 |
span.folder-loader-ajax {
|
408 |
outline: 0;
|
409 |
box-shadow: none
|
410 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
.sticky-title {
|
412 |
font-size: 16px;
|
413 |
font-weight: 700;
|
414 |
padding: 7px
|
415 |
}
|
|
|
416 |
div#custom-menu {
|
417 |
padding: 10px;
|
418 |
background: #fff;
|
515 |
text-align: left
|
516 |
}
|
517 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
#custom-menu [class*=" pfolder-"], #custom-menu [class^=pfolder-] {
|
519 |
font-size: 12px
|
520 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
.wcp-container .route .title .folder-sticky-icon, .wcp-container .route .title .move-folder-icon {
|
522 |
float: right;
|
523 |
position: relative;
|
529 |
display: none
|
530 |
}
|
531 |
|
532 |
+
.wcp-container .route.is-sticky > h3.title .folder-sticky-icon, .wcp-container .route.is-sticky > h3.title .move-folder-icon {
|
533 |
+
display: block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
}
|
535 |
|
536 |
.nav-icon {
|
614 |
.dynamic-menu li {
|
615 |
position: relative;
|
616 |
width: 100%;
|
617 |
+
display: block !important;
|
618 |
padding: 2px 0;
|
619 |
margin: 0
|
620 |
}
|
720 |
font-size: 14px;
|
721 |
padding: 0 0 0 15px;
|
722 |
display: block;
|
723 |
+
width: 100%;
|
724 |
border-radius: 4px;
|
725 |
border: 1px solid #484848;
|
726 |
height: 34px;
|
1083 |
html[dir=rtl] .media-frame.hide-menu .media-frame-content, html[dir=rtl] .media-frame.hide-menu .media-frame-router, html[dir=rtl] .media-frame.hide-menu .media-frame-title, html[dir=rtl] .media-frame.hide-menu .media-frame-toolbar {
|
1084 |
left: 0;
|
1085 |
right: 275px;
|
1086 |
+
}
|
1087 |
+
.sticky-folders > ul > li {
|
1088 |
+
position: relative;
|
1089 |
+
}
|
1090 |
+
#vakata-dnd {
|
1091 |
+
z-index: 10000000 !important;
|
1092 |
}
|
assets/css/page-post-media.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.folder-custom-menu{width:275px;z-index:10001;position:absolute;height:100%;border-right:solid 1px #ddd;background:#f1f1f1;direction:ltr}.media-frame.hide-menu .media-frame-content,.media-frame.hide-menu .media-frame-router,.media-frame.hide-menu .media-frame-title,.media-frame.hide-menu .media-frame-toolbar{left:275px}.wcp-container{padding:20px 20px 20px 16px}.form-title{font-size:23px;font-weight:400;margin:0;padding:0 0 10px 0;line-height:29px;min-height:36px}.media-frame a.add-new-folder{text-decoration:none;display:block;float:right;font-size:14px;padding:4px 10px 4px 4px;background:#f51366;color:#fff;border:solid 1px #f51366;border-radius:4px;line-height:24px;position:relative}.add-new-folder span{display:block;float:left;line-height:24px;font-size:14px;margin-right:5px}span.create_new_folder{width:26px;height:26px;line-height:26px;font-size:14px;background:rgba(255,255,255,.4);backdrop-filter:blur(16px);border-radius:4px;text-align:center;margin:0 10px 0 0}span.folder-loader-ajax{float:right;margin:0;line-height:30px;display:none}.folder-loader-ajax.active{display:inline-block}@-webkit-keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes drawCircle{0%{stroke-dashoffset:151px}100%{stroke-dashoffset:0}}@keyframes drawCircle{0%{stroke-dashoffset:151px}100%{stroke-dashoffset:0}}@-webkit-keyframes drawCheck{0%{stroke-dashoffset:36px}100%{stroke-dashoffset:0}}@keyframes drawCheck{0%{stroke-dashoffset:36px}100%{stroke-dashoffset:0}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}#successAnimationCircle{stroke-dasharray:151px 151px;stroke:#2ce0a7}#successAnimationCheck{stroke-dasharray:36px 36px;stroke:#2ce0a7}#successAnimationResult{fill:#2ce0a7;opacity:0}svg#successAnimation{width:30px;height:34px;padding:0;display:none;float:left}#successAnimation.active{display:inline-block}.folder-loader-ajax img{display:none}#successAnimation.animated{-webkit-animation:1s ease-out 0s 1 both scaleAnimation;animation:1s ease-out 0s 1 both scaleAnimation}#successAnimation.animated #successAnimationCircle{-webkit-animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCircle,.3s linear .9s 1 both fadeOut;animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCircle,.3s linear .9s 1 both fadeOut}#successAnimation.animated #successAnimationCheck{-webkit-animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCheck,.3s linear .9s 1 both fadeOut;animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCheck,.3s linear .9s 1 both fadeOut}#successAnimation.animated #successAnimationResult{-webkit-animation:.3s linear .9s both fadeIn;animation:.3s linear .9s both fadeIn}.form-options{background:#fff;padding:5px;margin:0 0;border-radius:4px;box-shadow:0 4px 21px rgba(7,16,28,.1)}.wcp-container ul{list-style:none}.form-options ul{margin:0;padding:0}.form-options>ul>li{display:inline-block;margin:0 2px 0 0;vertical-align:top}.form-options>ul>li.last{margin:0}.form-options>ul>li.last.folder-checkbox{padding:5px 0 0}.form-options>ul>li>a{display:inline-block;text-decoration:none;padding:5px 5px;color:#000;vertical-align:middle;margin:0 0 5px 0;background:#f1f1f1;border-radius:4px}.form-options span.icon{font-size:12px;display:inline-block;vertical-align:baseline;color:#a4c0d2}.wcp-hide-show-buttons{display:none}.folder-order{position:relative}.form-options>ul>li.last>a.sort-folder-order{width:28px;padding:5px;text-align:center;display:inline-block;box-sizing:border-box}.folder-sort-menu{position:absolute;right:0;width:120px;z-index:101;background:#fff;-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.25);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.25);box-shadow:0 0 5px 0 rgba(0,0,0,.25);display:none}.folder-sort-menu li{display:block;margin:0;padding:0;background:0 0}.folder-sort-menu li a{display:block;margin:0;padding:3px 5px;background:0 0;color:#848484;text-decoration:none;font-size:14px}span.upgrade-message{padding:0;background:#fff;display:inline-block;font-size:12px;color:#000}span.upgrade-message a.pink,span.upgrade-message span.pink{color:#ff5983;text-decoration:none;font-weight:700}.form-loader{width:100%;height:5px;margin:0 0 10px}.form-loader-count{width:0;height:5px;background:url(../images/form-loader.png);transition:all 2.5s linear;-webkit-transition:all 2s linear;-moz-transition:all 2.5s linear}.top-settings{background:#fff;padding:10px 10px 5px;-webkit-border-top-left-radius:4px;-webkit-border-top-right-radius:4px;-moz-border-radius-topleft:4px;-moz-border-radius-topright:4px;border-top-left-radius:4px;border-top-right-radius:4px;box-shadow:0 4px 21px rgba(7,16,28,.1)}.header-posts a,.un-categorised-items a{color:#444;padding:7px;display:block;text-decoration:none;font-size:14px;border-radius:4px;line-height:18px}.header-posts a.active-item,.orange-bg>span,.un-categorised-items.active-item,.wcp-container .route.active-item>h3.title{background-color:#fa166b!important;color:#fff}.header-posts a.active-item span.total-count,.un-categorised-items.active-item span.total-count,.wcp-container .route.active-item>h3.title span.total-count{color:#fff!important}.wcp-icon{display:inline-block;font-size:16px;vertical-align:top;margin-right:3px}span.total-count{float:right;font-size:12px;line-height:16px}.header-posts a.active-item span.total-count,.un-categorised-items.active-item a span{color:#fff!important}.header-posts a:hover,.un-categorised-items.active-item,.un-categorised-items:hover{background:rgba(250,22,107,.08);border-radius:4px;color:#444}.un-categorised-items.active-item a,.un-categorised-items.active-item a:hover{color:#fff}.un-categorised-items a:hover,.un-categorised-items:hover a{color:#444}.media-frame .folder-custom-menu a:focus{outline:0;box-shadow:none}.sticky-folders{display:none;padding:0 0 5px;margin:0 0 5px;border-bottom:solid 1px #ccc}.sticky-title{font-size:16px;font-weight:700;padding:7px}div#custom-menu{padding:10px;background:#fff;box-shadow:0 4px 21px rgba(7,16,28,.1)}.wcp-container .space{position:relative;list-style-type:none;border:0;margin:0 0 0 20px;padding:0 0 30px 0;width:40px;top:30px;height:100%;z-index:1}.wcp-container .first-space{margin-left:0;top:0;padding:0}.wcp-container .route{position:relative;list-style-type:none;border:0;margin:0;padding:0;top:0;max-height:100%!important;width:100%;border-radius:2px;z-index:-1;background:0 0}.wcp-container .route .title{position:absolute;border:0;margin:0;padding:0;height:30px;width:200px;text-indent:28px;background:0 0;box-shadow:none;font-size:13px;line-height:26px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;overflow:hidden;font-weight:400}.wcp-container .route span{position:absolute;top:2px;left:0;z-index:10;width:20px;height:18px;text-indent:0;font-size:20px;background:no-repeat;text-align:center}.wcp-container .route span.ui-icon{line-height:24px;font-size:18px;cursor:move;left:5px;top:2px;height:26px}#custom-menu .wcp-icon{font-size:16px!important;line-height:24px}#custom-menu input.checkbox{display:none}.wcp-container .route span.title-text{position:relative;top:auto;left:auto;display:inline-block;font-size:16px;line-height:30px;height:30px;width:calc(100% - 100px);overflow:hidden;white-space:nowrap;text-align:left}.sticky-folders li a span.update-inline-record,.wcp-container .route span.update-inline-record{position:relative;left:auto;top:0;float:right;width:0;height:30px;font-size:16px;overflow:hidden;transition:all .25s linear;-webkit-transition:all .25s linear;-moz-transition:all .25s linear;line-height:30px}#custom-menu [class*=" pfolder-"],#custom-menu [class^=pfolder-]{font-size:12px}.sticky-folders li a span.star-icon,.wcp-container .route span.star-icon{position:relative;top:2px;left:auto;float:right;speak:none;color:#ffc90e;display:none;font-size:14px}.wcp-container .route .title .folder-sticky-icon,.wcp-container .route .title .move-folder-icon{float:right;position:relative;top:0;left:auto;width:20px;height:30px;line-height:26px;display:none}.wcp-container .route .title .folder-sticky-icon,.wcp-container .route .title .move-folder-icon{float:right;position:relative;top:0;left:auto;width:20px;height:30px;line-height:26px;display:none}.nav-icon{display:none;left:-10px!important;cursor:pointer}#custom-menu .route .nav-icon .wcp-icon{font-size:9px!important;color:#fa166b;font-weight:700;transform:rotate(-90deg);transition:all .25s linear}.header-posts a,.un-categorised-items a,.wcp-container .route span.title-text{font-size:12px}.wcp-container .route span.total-count{position:relative;font-size:10px;float:right;text-align:center;width:auto;display:block;margin:4px 8px 3px 3px;color:#23282d!important;line-height:16px;height:16px}.has-sub-tree>.nav-icon{display:block}.has-sub-tree>ul.ui-sortable li{display:none}.has-sub-tree.active>ul.ui-sortable>li{display:block}body:not(.no-hover-css) .wcp-container .route .title:hover{background:rgba(250,22,107,.08);cursor:pointer}body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .move-folder-icon,body:not(.no-hover-css) .wcp-container .route .title:hover .move-folder-icon{display:block}body:not(.no-hover-css) .wcp-container .route .title:hover>.folder-sticky-icon,body:not(.no-hover-css) .wcp-container .route .title:hover>.star-icon{display:none!important}body:not(.no-hover-css) .sticky-folders li a:hover span.update-inline-record,body:not(.no-hover-css) .wcp-container .route h3:hover>span.update-inline-record{width:18px}body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .ui-icon .pfolder-folder-close:before,body:not(.no-hover-css) .wcp-container .route .title:hover .ui-icon .pfolder-folder-close:before{content:"\e901"!important}.sticky-folders li.is-high a span.star-icon,.wcp-container .route.is-high>h3>span.star-icon{display:block}.dynamic-menu{position:absolute;left:50px;background:#fff;width:170px;padding:0;z-index:101;-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.25);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.25);box-shadow:0 0 5px 0 rgba(0,0,0,.25)}.dynamic-menu li{position:relative;width:100%;display:inline-block!important;padding:2px 0;margin:0}.dynamic-menu li.new-folder{border-bottom:solid 1px #d8d8d8}.dynamic-menu a{text-decoration:none;color:#848484;position:relative;display:block;padding:5px 10px;line-height:18px;white-space:nowrap}.dynamic-menu ul>li>a>span,.dynamic-menu ul>li>a>span span{position:relative!important;display:inline-block;vertical-align:middle;margin-right:5px;top:auto!important;width:20px!important;height:20px!important;line-height:14px}#custom-menu .dynamic-menu ul>li>a .sticky-pin{line-height:20px}#custom-menu .dynamic-menu ul>li>a .sticky-pin i{font-size:16px!important}li.active-menu{z-index:2!important}.dynamic-menu a.active,.dynamic-menu a:hover{background:#efefef;color:#000}.folder-popup-form{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.5);top:0;left:0;z-index:10001;display:none}.popup-form-content{background:#fff;min-height:100px;width:400px;text-align:center;margin:0 auto;position:absolute;left:0;right:0;top:50%;transform:translate(0,-50%);-webkit-transform:translate(0,-50%);-moz-transform:translate(0,-50%);-o-transform:translate(0,-50%);-ms-transform:translate(0,-50%);padding:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;color:#484848}.add-update-folder-title{display:block;position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;text-align:center;text-transform:none;word-wrap:break-word;font-weight:700;font-size:22px;line-height:26px}.folder-group{position:relative;margin:45px auto 15px;padding:0 2px}.folder-group input,.folder-group textarea{background:0 0;font-size:14px;padding:0 0 0 15px;display:block;width:100%!important;border-radius:4px;border:1px solid #484848;height:34px;line-height:34px;color:#484848;outline:0}.highlight{background-color:#e4f2fd;color:#000}.folder-group .folder-bar{position:relative;display:block;width:320px}.folder-group label{font-size:14px;font-weight:500;position:absolute;pointer-events:none;left:20px;top:10px;-webkit-transition:.3s ease all;transition:.3s ease all;color:#484848}.folder-form-errors{margin:0 0 10px 0;padding:8px 0;background:#ffe4e4;color:#a20000;display:none}.folder-form-buttons{display:flex}.folder-form-buttons a,.folder-form-buttons button{display:inline-flex;padding:0;text-decoration:none;margin:10px 3px;border-radius:4px;border:solid 1px #1da1f4;line-height:34px;font-weight:700;font-size:14px;box-sizing:border-box;height:36px;cursor:pointer;flex:1;justify-content:center;outline:0;color:#fff}.folder-form-buttons .form-cancel-btn,.folder-form-buttons a.form-cancel-btn:hover{background-color:#fff;color:#3085d6;outline:0}.form-submit-btn,.form-submit-btn:hover{background-color:#3085d6;color:#fff!important;outline:0}.folder-group input:focus~label,.folder-group input:valid~label,.folder-group textarea:focus~label,.folder-group textarea:valid~label{top:-9px;background:#fff;padding:0 5px;font-weight:400;font-size:12px;line-height:14px;color:#aeaeae}#no-more-folder-credit .folder-form-message{margin:20px 80px;font-size:14px}.folder-form-message{margin:25px auto;font-size:15px;line-height:18px;color:#484848;width:310px}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.folder-form-buttons a span,.folder-form-buttons button span{-webkit-animation:fa-spin .75s infinite linear;animation:fa-spin .75s infinite linear;padding:7px}.wcp-container .folder-tooltip{position:relative}.wcp-container .folder-tooltip::after,.wcp-container .folder-tooltip::before{text-transform:none;font-size:.9em;line-height:1;user-select:none;pointer-events:none;position:absolute;display:none;opacity:0}.wcp-container .folder-tooltip::before{content:'';border:5px solid transparent;z-index:1001}.wcp-container .folder-tooltip::after{content:attr(data-folder-tooltip);font-family:Helvetica,sans-serif;text-align:center;min-width:3em;max-width:21em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:1ch 1.5ch;border-radius:.3ch;box-shadow:0 1em 2em -.5em rgba(0,0,0,.35);background:#333;color:#fff;z-index:1000}.wcp-container .folder-tooltip:hover::after,.wcp-container .folder-tooltip:hover::before{display:block;opacity:1}.wcp-container .folder-tooltip:not([flow])::before,.wcp-container .folder-tooltip[flow^=up]::before{bottom:100%;border-bottom-width:0;border-top-color:#333}.wcp-container .folder-tooltip:not([flow])::after,.wcp-container .folder-tooltip[flow^=up]::after{bottom:calc(100% + 5px)}.wcp-container .folder-tooltip:not([flow])::after,.wcp-container .folder-tooltip:not([flow])::before,.wcp-container .folder-tooltip[flow^=up]::after,.wcp-container .folder-tooltip[flow^=up]::before{left:50%;transform:translate(-50%,-.5em)}.folder-order.active .folder-sort-menu{display:block}.folder-sort-menu li a.active,.folder-sort-menu li a:hover{background:#efefef;color:#000}.media-toolbar-secondary select{width:30%!important;width:calc(30% - 10px)!important;margin:32px 10px 0 0!important}.media-frame .uploader-inline{z-index:1}.wcp-drop-hover{background:#fa166b!important;z-index:2!important;color:#fff!important}.wcp-drop-hover i{color:#fff!important}.selected-items{background:#0073aa;color:#fff;padding:10px 20px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;margin-top:0;cursor:none;font-size:12px;z-index:10001!important}.media-frame,.media-frame .attachments-browser,.media-frame-content{overflow:inherit}#custom-menu .route.active .nav-icon .wcp-icon{transform:rotate(0);-webkit-transform:rotate(0)}.expand-collapse.all-open span.icon{transform:rotate(180deg);-webkit-transform:rotate(180deg)}.folder-search-form{padding:0 0 10px 0;position:relative}.folder-search-form input{background:#fff;border:1px solid #dbdbdb!important;box-sizing:border-box;border-radius:4px;height:32px;line-height:32px;box-sizing:border-box;padding:0 5px!important;width:100%!important;box-shadow:none!important;outline:0}.folder-search-form span{position:absolute;color:#aeaeae;right:0;top:0;height:32px;line-height:32px;width:32px;text-align:center}.folder-separator{padding:0 10px;height:1px;background:#e9e5e5;margin:0 0 10px 0}.wcp-drop-hover i{color:#fff!important}.ui-draggable-dragging{z-index:10051!important}.attachments.ui-sortable.ui-draggable-dragging{z-index:10001!important}#custom-menu.has-filter li.route{display:none!important}#custom-menu.has-filter li.route.has-search{display:block!important}#custom-menu.has-filter h3 span.title-text.has-search-text{font-weight:700}.form-options>ul>li>a:hover{background:#404040;color:#fff}#custom-menu.show-folder-checkbox input.checkbox{display:block;margin:5px 0 0 0}#custom-menu.show-folder-checkbox h3.title>.ui-icon>i,#custom-menu.show-folder-checkbox h3.title>.ui-icon>img{display:none!important}.plugin-button{float:right}.plugin-button.d-block{float:none}.plugin-title{display:inline-block}.form-options .form-options{background:0 0;padding:0;box-shadow:none}.attachments-browser .media-toolbar-secondary{width:78%;max-width:inherit}.media-toolbar-primary.search-form{width:20%;max-width:inherit}body .media-frame.hide-menu .media-frame-menu{display:block}.folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-content,.folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-router,.folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-title,.folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-toolbar{left:275px}.media-frame-menu.has-folder-menu{width:275px}.media-frame-menu.has-folder-menu .folder-custom-menu{position:relative;border:none;width:100%}.media-frame.mode-select.hide-router .media-frame-content,.media-frame.mode-select.hide-router .media-frame-router,.media-frame.mode-select.hide-router .media-frame-title,.media-frame.mode-select.hide-router .media-frame-toolbar{left:275px}.media-frame.mode-select.hide-router select#media-attachment-taxonomy-filter{display:none}.media-frame.mode-select.hide-router .folder-custom-menu{display:none}html[dir=rtl] .folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-content,html[dir=rtl] .folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-router,html[dir=rtl] .folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-title,html[dir=rtl] .folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-toolbar{left:0;right:275px}html[dir=rtl] .media-frame.mode-select.hide-router .media-frame-content,html[dir=rtl] .media-frame.mode-select.hide-router .media-frame-router,html[dir=rtl] .media-frame.mode-select.hide-router .media-frame-title,html[dir=rtl] .media-frame.mode-select.hide-router .media-frame-toolbar{left:0;right:275px}html[dir=rtl] .media-frame.hide-menu .media-frame-content,html[dir=rtl] .media-frame.hide-menu .media-frame-router,html[dir=rtl] .media-frame.hide-menu .media-frame-title,html[dir=rtl] .media-frame.hide-menu .media-frame-toolbar{left:0;right:275px}
|
1 |
+
.folder-custom-menu{width:275px;z-index:10001;position:absolute;height:100%;border-right:solid 1px #ddd;background:#f1f1f1;direction:ltr}.media-frame.hide-menu .media-frame-content,.media-frame.hide-menu .media-frame-router,.media-frame.hide-menu .media-frame-title,.media-frame.hide-menu .media-frame-toolbar{left:275px}.wcp-container{padding:20px 20px 20px 16px}.form-title{font-size:23px;font-weight:400;margin:0;padding:0 0 10px 0;line-height:29px;min-height:36px}.media-frame a.add-new-folder{text-decoration:none;display:block;float:right;font-size:14px;padding:4px 10px 4px 4px;background:#f51366;color:#fff;border:solid 1px #f51366;border-radius:4px;line-height:24px;position:relative}.add-new-folder span{display:block;float:left;line-height:24px;font-size:14px;margin-right:5px}span.create_new_folder{width:26px;height:26px;line-height:26px;font-size:14px;background:rgba(255,255,255,.4);backdrop-filter:blur(16px);border-radius:4px;text-align:center;margin:0 15px 0 0}span.folder-loader-ajax{float:right;margin:0;line-height:30px;display:none}.folder-loader-ajax.active{display:inline-block}@-webkit-keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes drawCircle{0%{stroke-dashoffset:151px}100%{stroke-dashoffset:0}}@keyframes drawCircle{0%{stroke-dashoffset:151px}100%{stroke-dashoffset:0}}@-webkit-keyframes drawCheck{0%{stroke-dashoffset:36px}100%{stroke-dashoffset:0}}@keyframes drawCheck{0%{stroke-dashoffset:36px}100%{stroke-dashoffset:0}}@-webkit-keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@keyframes fadeOut{0%{opacity:1}100%{opacity:0}}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}#successAnimationCircle{stroke-dasharray:151px 151px;stroke:#2ce0a7}#successAnimationCheck{stroke-dasharray:36px 36px;stroke:#2ce0a7}#successAnimationResult{fill:#2ce0a7;opacity:0}svg#successAnimation{width:30px;height:34px;padding:0;display:none;float:left}#successAnimation.active{display:inline-block}.folder-loader-ajax img{display:none}#successAnimation.animated{-webkit-animation:1s ease-out 0s 1 both scaleAnimation;animation:1s ease-out 0s 1 both scaleAnimation}#successAnimation.animated #successAnimationCircle{-webkit-animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCircle,.3s linear .9s 1 both fadeOut;animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCircle,.3s linear .9s 1 both fadeOut}#successAnimation.animated #successAnimationCheck{-webkit-animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCheck,.3s linear .9s 1 both fadeOut;animation:1s cubic-bezier(.77,0,.175,1) 0s 1 both drawCheck,.3s linear .9s 1 both fadeOut}#successAnimation.animated #successAnimationResult{-webkit-animation:.3s linear .9s both fadeIn;animation:.3s linear .9s both fadeIn}.form-options{background:#fff;padding:5px;margin:0 0;border-radius:4px;box-shadow:0 4px 21px rgba(7,16,28,.1)}.wcp-container ul{list-style:none}.form-options ul{margin:0;padding:0}.form-options>ul>li{display:inline-block;margin:0 2px 0 0;vertical-align:top}.form-options>ul>li.last{margin:0}.form-options>ul>li.last.folder-checkbox{padding:5px 0 0}.form-options>ul>li>a{display:inline-block;text-decoration:none;padding:5px 5px;color:#000;vertical-align:middle;margin:0 0 5px 0;background:#f1f1f1;border-radius:4px}.form-options span.icon{font-size:12px;display:inline-block;vertical-align:baseline;color:#a4c0d2}.wcp-hide-show-buttons{display:none}.folder-order{position:relative}.form-options>ul>li.last>a.sort-folder-order{width:28px;padding:5px;text-align:center;display:inline-block;box-sizing:border-box}.folder-sort-menu{position:absolute;right:0;width:120px;z-index:101;background:#fff;-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.25);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.25);box-shadow:0 0 5px 0 rgba(0,0,0,.25);display:none}.folder-sort-menu li{display:block;margin:0;padding:0;background:0 0}.folder-sort-menu li a{display:block;margin:0;padding:3px 5px;background:0 0;color:#848484;text-decoration:none;font-size:14px}span.upgrade-message{padding:0;background:#fff;display:inline-block;font-size:12px;color:#000}span.upgrade-message a.pink,span.upgrade-message span.pink{color:#ff5983;text-decoration:none;font-weight:700}.form-loader{width:100%;height:5px;margin:0 0 10px}.form-loader-count{width:0;height:5px;background:url(../images/form-loader.png);transition:all 2.5s linear;-webkit-transition:all 2s linear;-moz-transition:all 2.5s linear}.top-settings{background:#fff;padding:10px 10px 5px;-webkit-border-top-left-radius:4px;-webkit-border-top-right-radius:4px;-moz-border-radius-topleft:4px;-moz-border-radius-topright:4px;border-top-left-radius:4px;border-top-right-radius:4px;box-shadow:0 4px 21px rgba(7,16,28,.1)}.header-posts a,.un-categorised-items a{color:#444;padding:7px;display:block;text-decoration:none;font-size:14px;border-radius:4px;line-height:18px}.header-posts a.active-item,.orange-bg>span,.un-categorised-items.active-item,.wcp-container .route.active-item>h3.title{background-color:#fa166b!important;color:#fff}.header-posts a.active-item span.total-count,.un-categorised-items.active-item span.total-count,.wcp-container .route.active-item>h3.title span.total-count{color:#fff!important}.wcp-icon{display:inline-block;font-size:16px;vertical-align:top;margin-right:3px}span.total-count{float:right;font-size:12px;line-height:16px}.header-posts a.active-item span.total-count,.un-categorised-items.active-item a span{color:#fff!important}.header-posts a:hover,.un-categorised-items.active-item,.un-categorised-items:hover{background:rgba(250,22,107,.08);border-radius:4px;color:#444}.un-categorised-items.active-item a,.un-categorised-items.active-item a:hover{color:#fff}.un-categorised-items a:hover,.un-categorised-items:hover a{color:#444}.media-frame .folder-custom-menu a:focus{outline:0;box-shadow:none}.sticky-title{font-size:16px;font-weight:700;padding:7px}div#custom-menu{padding:10px;background:#fff;box-shadow:0 4px 21px rgba(7,16,28,.1)}.wcp-container .space{position:relative;list-style-type:none;border:0;margin:0 0 0 20px;padding:0 0 30px 0;width:40px;top:30px;height:100%;z-index:1}.wcp-container .first-space{margin-left:0;top:0;padding:0}.wcp-container .route{position:relative;list-style-type:none;border:0;margin:0;padding:0;top:0;max-height:100%!important;width:100%;border-radius:2px;z-index:-1;background:0 0}.wcp-container .route .title{position:absolute;border:0;margin:0;padding:0;height:30px;width:200px;text-indent:28px;background:0 0;box-shadow:none;font-size:13px;line-height:26px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;overflow:hidden;font-weight:400}.wcp-container .route span{position:absolute;top:2px;left:0;z-index:10;width:20px;height:18px;text-indent:0;font-size:20px;background:no-repeat;text-align:center}.wcp-container .route span.ui-icon{line-height:24px;font-size:18px;cursor:move;left:5px;top:2px;height:26px}#custom-menu .wcp-icon{font-size:16px!important;line-height:24px}#custom-menu input.checkbox{display:none}.wcp-container .route span.title-text{position:relative;top:auto;left:auto;display:inline-block;font-size:16px;line-height:30px;height:30px;width:calc(100% - 100px);overflow:hidden;white-space:nowrap;text-align:left}#custom-menu [class*=" pfolder-"],#custom-menu [class^=pfolder-]{font-size:12px}.wcp-container .route .title .folder-sticky-icon,.wcp-container .route .title .move-folder-icon{float:right;position:relative;top:0;left:auto;width:20px;height:30px;line-height:26px;display:none}.wcp-container .route.is-sticky>h3.title .folder-sticky-icon,.wcp-container .route.is-sticky>h3.title .move-folder-icon{display:block}.nav-icon{display:none;left:-10px!important;cursor:pointer}#custom-menu .route .nav-icon .wcp-icon{font-size:9px!important;color:#fa166b;font-weight:700;transform:rotate(-90deg);transition:all .25s linear}.header-posts a,.un-categorised-items a,.wcp-container .route span.title-text{font-size:12px}.wcp-container .route span.total-count{position:relative;font-size:10px;float:right;text-align:center;width:auto;display:block;margin:4px 8px 3px 3px;color:#23282d!important;line-height:16px;height:16px}.has-sub-tree>.nav-icon{display:block}.has-sub-tree>ul.ui-sortable li{display:none}.has-sub-tree.active>ul.ui-sortable>li{display:block}body:not(.no-hover-css) .wcp-container .route .title:hover{background:rgba(250,22,107,.08);cursor:pointer}body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .move-folder-icon,body:not(.no-hover-css) .wcp-container .route .title:hover .move-folder-icon{display:block}body:not(.no-hover-css) .wcp-container .route .title:hover>.folder-sticky-icon,body:not(.no-hover-css) .wcp-container .route .title:hover>.star-icon{display:none!important}body:not(.no-hover-css) .sticky-folders li a:hover span.update-inline-record,body:not(.no-hover-css) .wcp-container .route h3:hover>span.update-inline-record{width:18px}body:not(.no-hover-css) .wcp-container .route .title.wcp-drop-hover .ui-icon .pfolder-folder-close:before,body:not(.no-hover-css) .wcp-container .route .title:hover .ui-icon .pfolder-folder-close:before{content:"\e901"!important}.sticky-folders li.is-high a span.star-icon,.wcp-container .route.is-high>h3>span.star-icon{display:block}.dynamic-menu{position:absolute;left:50px;background:#fff;width:170px;padding:0;z-index:101;-webkit-box-shadow:0 0 5px 0 rgba(0,0,0,.25);-moz-box-shadow:0 0 5px 0 rgba(0,0,0,.25);box-shadow:0 0 5px 0 rgba(0,0,0,.25)}.dynamic-menu li{position:relative;width:100%;display:block!important;padding:2px 0;margin:0}.dynamic-menu li.new-folder{border-bottom:solid 1px #d8d8d8}.dynamic-menu a{text-decoration:none;color:#848484;position:relative;display:block;padding:5px 10px;line-height:18px;white-space:nowrap}.dynamic-menu ul>li>a>span,.dynamic-menu ul>li>a>span span{position:relative!important;display:inline-block;vertical-align:middle;margin-right:5px;top:auto!important;width:20px!important;height:20px!important;line-height:14px}#custom-menu .dynamic-menu ul>li>a .sticky-pin{line-height:20px}#custom-menu .dynamic-menu ul>li>a .sticky-pin i{font-size:16px!important}li.active-menu{z-index:2!important}.dynamic-menu a.active,.dynamic-menu a:hover{background:#efefef;color:#000}.folder-popup-form{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.5);top:0;left:0;z-index:10001;display:none}.popup-form-content{background:#fff;min-height:100px;width:400px;text-align:center;margin:0 auto;position:absolute;left:0;right:0;top:50%;transform:translate(0,-50%);-webkit-transform:translate(0,-50%);-moz-transform:translate(0,-50%);-o-transform:translate(0,-50%);-ms-transform:translate(0,-50%);padding:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;color:#484848}.add-update-folder-title{display:block;position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;text-align:center;text-transform:none;word-wrap:break-word;font-weight:700;font-size:22px;line-height:26px}.folder-group{position:relative;margin:45px auto 15px;padding:0 2px}.folder-group input,.folder-group textarea{background:0 0;font-size:14px;padding:0 0 0 15px;display:block;width:100%;border-radius:4px;border:1px solid #484848;height:34px;line-height:34px;color:#484848;outline:0}.highlight{background-color:#e4f2fd;color:#000}.folder-group .folder-bar{position:relative;display:block;width:320px}.folder-group label{font-size:14px;font-weight:500;position:absolute;pointer-events:none;left:20px;top:10px;-webkit-transition:.3s ease all;transition:.3s ease all;color:#484848}.folder-form-errors{margin:0 0 10px 0;padding:8px 0;background:#ffe4e4;color:#a20000;display:none}.folder-form-buttons{display:flex}.folder-form-buttons a,.folder-form-buttons button{display:inline-flex;padding:0;text-decoration:none;margin:10px 3px;border-radius:4px;border:solid 1px #1da1f4;line-height:34px;font-weight:700;font-size:14px;box-sizing:border-box;height:36px;cursor:pointer;flex:1;justify-content:center;outline:0;color:#fff}.folder-form-buttons .form-cancel-btn,.folder-form-buttons a.form-cancel-btn:hover{background-color:#fff;color:#3085d6;outline:0}.form-submit-btn,.form-submit-btn:hover{background-color:#3085d6;color:#fff!important;outline:0}.folder-group input:focus~label,.folder-group input:valid~label,.folder-group textarea:focus~label,.folder-group textarea:valid~label{top:-9px;background:#fff;padding:0 5px;font-weight:400;font-size:12px;line-height:14px;color:#aeaeae}#no-more-folder-credit .folder-form-message{margin:20px 80px;font-size:14px}.folder-form-message{margin:25px auto;font-size:15px;line-height:18px;color:#484848;width:310px}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.folder-form-buttons a span,.folder-form-buttons button span{-webkit-animation:fa-spin .75s infinite linear;animation:fa-spin .75s infinite linear;padding:7px}.wcp-container .folder-tooltip{position:relative}.wcp-container .folder-tooltip::after,.wcp-container .folder-tooltip::before{text-transform:none;font-size:.9em;line-height:1;user-select:none;pointer-events:none;position:absolute;display:none;opacity:0}.wcp-container .folder-tooltip::before{content:'';border:5px solid transparent;z-index:1001}.wcp-container .folder-tooltip::after{content:attr(data-folder-tooltip);font-family:Helvetica,sans-serif;text-align:center;min-width:3em;max-width:21em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:1ch 1.5ch;border-radius:.3ch;box-shadow:0 1em 2em -.5em rgba(0,0,0,.35);background:#333;color:#fff;z-index:1000}.wcp-container .folder-tooltip:hover::after,.wcp-container .folder-tooltip:hover::before{display:block;opacity:1}.wcp-container .folder-tooltip:not([flow])::before,.wcp-container .folder-tooltip[flow^=up]::before{bottom:100%;border-bottom-width:0;border-top-color:#333}.wcp-container .folder-tooltip:not([flow])::after,.wcp-container .folder-tooltip[flow^=up]::after{bottom:calc(100% + 5px)}.wcp-container .folder-tooltip:not([flow])::after,.wcp-container .folder-tooltip:not([flow])::before,.wcp-container .folder-tooltip[flow^=up]::after,.wcp-container .folder-tooltip[flow^=up]::before{left:50%;transform:translate(-50%,-.5em)}.folder-order.active .folder-sort-menu{display:block}.folder-sort-menu li a.active,.folder-sort-menu li a:hover{background:#efefef;color:#000}.media-toolbar-secondary select{width:30%!important;width:calc(30% - 10px)!important;margin:32px 10px 0 0!important}.media-frame .uploader-inline{z-index:1}.wcp-drop-hover{background:#fa166b!important;z-index:2!important;color:#fff!important}.wcp-drop-hover i{color:#fff!important}.selected-items{background:#0073aa;color:#fff;padding:10px 20px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;margin-top:0;cursor:none;font-size:12px;z-index:10001!important}.media-frame,.media-frame .attachments-browser,.media-frame-content{overflow:inherit}#custom-menu .route.active .nav-icon .wcp-icon{transform:rotate(0);-webkit-transform:rotate(0)}.expand-collapse.all-open span.icon{transform:rotate(180deg);-webkit-transform:rotate(180deg)}.folder-search-form{padding:0 0 10px 0;position:relative}.folder-search-form input{background:#fff;border:1px solid #dbdbdb!important;box-sizing:border-box;border-radius:4px;height:32px;line-height:32px;box-sizing:border-box;padding:0 5px!important;width:100%!important;box-shadow:none!important;outline:0}.folder-search-form span{position:absolute;color:#aeaeae;right:0;top:0;height:32px;line-height:32px;width:32px;text-align:center}.folder-separator{padding:0 10px;height:1px;background:#e9e5e5;margin:0 0 10px 0}.wcp-drop-hover i{color:#fff!important}.ui-draggable-dragging{z-index:10051!important}.attachments.ui-sortable.ui-draggable-dragging{z-index:10001!important}#custom-menu.has-filter li.route{display:none!important}#custom-menu.has-filter li.route.has-search{display:block!important}#custom-menu.has-filter h3 span.title-text.has-search-text{font-weight:700}.form-options>ul>li>a:hover{background:#404040;color:#fff}#custom-menu.show-folder-checkbox input.checkbox{display:block;margin:5px 0 0 0}#custom-menu.show-folder-checkbox h3.title>.ui-icon>i,#custom-menu.show-folder-checkbox h3.title>.ui-icon>img{display:none!important}.plugin-button{float:right}.plugin-button.d-block{float:none}.plugin-title{display:inline-block}.form-options .form-options{background:0 0;padding:0;box-shadow:none}.attachments-browser .media-toolbar-secondary{width:78%;max-width:inherit}.media-toolbar-primary.search-form{width:20%;max-width:inherit}body .media-frame.hide-menu .media-frame-menu{display:block}.folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-content,.folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-router,.folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-title,.folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-toolbar{left:275px}.media-frame-menu.has-folder-menu{width:275px}.media-frame-menu.has-folder-menu .folder-custom-menu{position:relative;border:none;width:100%}.media-frame.mode-select.hide-router .media-frame-content,.media-frame.mode-select.hide-router .media-frame-router,.media-frame.mode-select.hide-router .media-frame-title,.media-frame.mode-select.hide-router .media-frame-toolbar{left:275px}.media-frame.mode-select.hide-router select#media-attachment-taxonomy-filter{display:none}.media-frame.mode-select.hide-router .folder-custom-menu{display:none}html[dir=rtl] .folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-content,html[dir=rtl] .folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-router,html[dir=rtl] .folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-title,html[dir=rtl] .folder-modal .media-frame:not(.hide-menu):not(.hide-router) .media-frame-toolbar{left:0;right:275px}html[dir=rtl] .media-frame.mode-select.hide-router .media-frame-content,html[dir=rtl] .media-frame.mode-select.hide-router .media-frame-router,html[dir=rtl] .media-frame.mode-select.hide-router .media-frame-title,html[dir=rtl] .media-frame.mode-select.hide-router .media-frame-toolbar{left:0;right:275px}html[dir=rtl] .media-frame.hide-menu .media-frame-content,html[dir=rtl] .media-frame.hide-menu .media-frame-router,html[dir=rtl] .media-frame.hide-menu .media-frame-title,html[dir=rtl] .media-frame.hide-menu .media-frame-toolbar{left:0;right:275px}.sticky-folders>ul>li{position:relative}#vakata-dnd{z-index:10000000!important}
|
assets/css/select2.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
|
1 |
+
.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:#fff;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;-webkit-clip-path:inset(50%)!important;clip-path:inset(50%)!important;height:1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important;white-space:nowrap!important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:20px;top:10px;right:1px;width:20px;position:absolute}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid #000 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:0 0;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:#fff}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top,#fff 50%,#eee 100%);background-image:-o-linear-gradient(top,#fff 50%,#eee 100%);background-image:linear-gradient(to bottom,#fff 50%,#eee 100%);background-repeat:repeat-x}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top,#eee 50%,#ccc 100%);background-image:-o-linear-gradient(top,#eee 50%,#ccc 100%);background-image:linear-gradient(to bottom,#eee 50%,#ccc 100%);background-repeat:repeat-x}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:0 0;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top,#fff 0,#eee 50%);background-image:-o-linear-gradient(top,#fff 0,#eee 50%);background-image:linear-gradient(to bottom,#fff 0,#eee 50%);background-repeat:repeat-x}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top,#eee 50%,#fff 100%);background-image:-o-linear-gradient(top,#eee 50%,#fff 100%);background-image:linear-gradient(to bottom,#eee 50%,#fff 100%);background-repeat:repeat-x}.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
|
assets/images/32px.png
ADDED
Binary file
|
assets/images/40px.png
ADDED
Binary file
|
assets/js/folders.js
ADDED
@@ -0,0 +1,2245 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (factory) {
|
2 |
+
"use strict";
|
3 |
+
if (typeof define === 'function' && define.amd) {
|
4 |
+
define(['jquery'], factory);
|
5 |
+
}
|
6 |
+
else if(typeof module !== 'undefined' && module.exports) {
|
7 |
+
module.exports = factory(require('jquery'));
|
8 |
+
}
|
9 |
+
else {
|
10 |
+
factory(jQuery);
|
11 |
+
}
|
12 |
+
}(function ($, undefined) {
|
13 |
+
var treeId = "#js-tree-menu";
|
14 |
+
var nonce;
|
15 |
+
var activeRecordID = "";
|
16 |
+
var isItFromMedia = false;
|
17 |
+
var isDuplicate = false;
|
18 |
+
var isKeyActive;
|
19 |
+
var n_o_file;
|
20 |
+
var duplicateFolderId = 0;
|
21 |
+
var fileFolderID = 0;
|
22 |
+
var folderOrder = 0;
|
23 |
+
var isMultipleRemove = false;
|
24 |
+
var folderIDs = "";
|
25 |
+
var folderPropertyArray = [];
|
26 |
+
var folderCurrentURL = wcp_settings.page_url;
|
27 |
+
var listFolderString = "<li class='grid-view' data-id='__folder_id__' id='folder___folder_id__'>" +
|
28 |
+
"<div class='folder-item is-folder' data-id='__folder_id__'>" +
|
29 |
+
"<a title='__folder_name__' id='folder_view___folder_id__'" +
|
30 |
+
"class='folder-view __append_class__ has-new-folder'" +
|
31 |
+
"data-id='__folder_id__'>" +
|
32 |
+
"<span class='folder item-name'><span id='wcp_folder_text___folder_id__'" +
|
33 |
+
"class='folder-title'>__folder_name__</span></span>" +
|
34 |
+
"</a>" +
|
35 |
+
"</div>" +
|
36 |
+
"</li>";
|
37 |
+
$(document).ready(function(){
|
38 |
+
|
39 |
+
isKeyActive = parseInt(wcp_settings.is_key_active);
|
40 |
+
n_o_file = parseInt(wcp_settings.folders);
|
41 |
+
activeRecordID = parseInt(wcp_settings.selected_taxonomy);
|
42 |
+
|
43 |
+
initJSTree();
|
44 |
+
|
45 |
+
setCustomScrollForFolder();
|
46 |
+
|
47 |
+
var resizeDirection = (wcp_settings.isRTL == "1" || wcp_settings.isRTL == 1)?"w":"e";
|
48 |
+
$(".wcp-content").resizable( {
|
49 |
+
resizeHeight: false,
|
50 |
+
handles: resizeDirection,
|
51 |
+
minWidth: 100,
|
52 |
+
maxWidth: 500,
|
53 |
+
resize: function( e, ui ) {
|
54 |
+
var menuWidth = ui.size.width;
|
55 |
+
if(menuWidth <= 275) {
|
56 |
+
$(".plugin-button").addClass("d-block");
|
57 |
+
} else {
|
58 |
+
$(".plugin-button").removeClass("d-block");
|
59 |
+
}
|
60 |
+
if(menuWidth <= 225) {
|
61 |
+
menuWidth = 225;
|
62 |
+
}
|
63 |
+
if(wcp_settings.isRTL == "1") {
|
64 |
+
$("#wpcontent").css("padding-right", (menuWidth + 20) + "px");
|
65 |
+
$("#wpcontent").css("padding-left", "0px");
|
66 |
+
} else {
|
67 |
+
$("#wpcontent").css("padding-left", (menuWidth + 20) + "px");
|
68 |
+
}
|
69 |
+
newWidth = menuWidth - 40;
|
70 |
+
cssString = "";
|
71 |
+
classString = "";
|
72 |
+
for(i=0; i<=15; i++) {
|
73 |
+
classString += " .space > .jstree-node >";
|
74 |
+
currentWidth = newWidth - (13+(20*i));
|
75 |
+
cssString += "#js-tree-menu > "+classString+" .title { width: "+currentWidth+"px !important; } ";
|
76 |
+
cssString += "#js-tree-menu > "+classString+" .dynamic-menu { left: "+(currentWidth - 190)+"px !important; } ";
|
77 |
+
setStickyHeaderForMedia();
|
78 |
+
}
|
79 |
+
$("#wcp-custom-style").html("<style>"+cssString+"</style>");
|
80 |
+
if(ui.size.width <= 185) {
|
81 |
+
folderStatus = "hide";
|
82 |
+
$(".wcp-hide-show-buttons .toggle-buttons.show-folders").addClass("active");
|
83 |
+
$(".wcp-hide-show-buttons .toggle-buttons.hide-folders").removeClass("active");
|
84 |
+
$("#wcp-content").addClass("hide-folders-area");
|
85 |
+
if(wcp_settings.isRTL == "1") {
|
86 |
+
$("#wpcontent").css("padding-right", "20px");
|
87 |
+
$("#wpcontent").css("padding-left", "0px");
|
88 |
+
} else {
|
89 |
+
$("#wpcontent").css("padding-left", "20px");
|
90 |
+
}
|
91 |
+
} else {
|
92 |
+
if($("#wcp-content").hasClass("hide-folders-area")) {
|
93 |
+
folderStatus = "show";
|
94 |
+
$(".wcp-hide-show-buttons .toggle-buttons.show-folders").removeClass("active");
|
95 |
+
$(".wcp-hide-show-buttons .toggle-buttons.hide-folders").addClass("active");
|
96 |
+
$("#wcp-content").addClass("no-transition");
|
97 |
+
$("#wcp-content").removeClass("hide-folders-area");
|
98 |
+
if (wcp_settings.isRTL == "1") {
|
99 |
+
$("#wpcontent").css("padding-right", (wcp_settings.folder_width + 20) + "px");
|
100 |
+
$("#wpcontent").css("padding-left", "0px");
|
101 |
+
} else {
|
102 |
+
$("#wpcontent").css("padding-left", (wcp_settings.folder_width + 20) + "px");
|
103 |
+
}
|
104 |
+
setTimeout(function(){
|
105 |
+
$("#wcp-content").removeClass("no-transition");
|
106 |
+
}, 250);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
},
|
110 |
+
stop: function( e, ui ) {
|
111 |
+
var menuWidth = ui.size.width;
|
112 |
+
if(ui.size.width <= 275) {
|
113 |
+
$(".plugin-button").addClass("d-block");
|
114 |
+
} else {
|
115 |
+
$(".plugin-button").removeClass("d-block");
|
116 |
+
}
|
117 |
+
if(menuWidth <= 225) {
|
118 |
+
menuWidth = 225;
|
119 |
+
}
|
120 |
+
if(ui.size.width <= 185) {
|
121 |
+
folderStatus = "hide";
|
122 |
+
$(".wcp-hide-show-buttons .toggle-buttons.show-folders").addClass("active");
|
123 |
+
$(".wcp-hide-show-buttons .toggle-buttons.hide-folders").removeClass("active");
|
124 |
+
$("#wcp-content").addClass("hide-folders-area");
|
125 |
+
if(wcp_settings.isRTL == "1") {
|
126 |
+
$("#wpcontent").css("padding-right", "20px");
|
127 |
+
$("#wpcontent").css("padding-left", "0px");
|
128 |
+
} else {
|
129 |
+
$("#wpcontent").css("padding-left", "20px");
|
130 |
+
}
|
131 |
+
|
132 |
+
$.ajax({
|
133 |
+
url: wcp_settings.ajax_url,
|
134 |
+
data: "type=" + wcp_settings.post_type + "&action=wcp_change_folder_display_status&status=" + folderStatus +"&nonce="+nonce,
|
135 |
+
method: 'post',
|
136 |
+
success: function (res) {
|
137 |
+
setStickyHeaderForMedia();
|
138 |
+
}
|
139 |
+
});
|
140 |
+
} else {
|
141 |
+
if($("#wcp-content").hasClass("hide-folders-area")) {
|
142 |
+
folderStatus = "show";
|
143 |
+
$(".wcp-hide-show-buttons .toggle-buttons.show-folders").removeClass("active");
|
144 |
+
$(".wcp-hide-show-buttons .toggle-buttons.hide-folders").addClass("active");
|
145 |
+
$("#wcp-content").addClass("no-transition");
|
146 |
+
$("#wcp-content").removeClass("hide-folders-area");
|
147 |
+
if (wcp_settings.isRTL == "1") {
|
148 |
+
$("#wpcontent").css("padding-right", (wcp_settings.folder_width + 20) + "px");
|
149 |
+
$("#wpcontent").css("padding-left", "0px");
|
150 |
+
} else {
|
151 |
+
$("#wpcontent").css("padding-left", (wcp_settings.folder_width + 20) + "px");
|
152 |
+
}
|
153 |
+
setTimeout(function(){
|
154 |
+
$("#wcp-content").removeClass("no-transition");
|
155 |
+
}, 250);
|
156 |
+
}
|
157 |
+
}
|
158 |
+
nonce = wcp_settings.nonce;
|
159 |
+
wcp_settings.folder_width = ui.size.width;
|
160 |
+
$.ajax({
|
161 |
+
url: wcp_settings.ajax_url,
|
162 |
+
data: "type=" + wcp_settings.post_type + "&action=wcp_change_post_width&width=" + menuWidth+"&nonce="+nonce,
|
163 |
+
method: 'post',
|
164 |
+
success: function (res) {
|
165 |
+
setStickyHeaderForMedia();
|
166 |
+
}
|
167 |
+
});
|
168 |
+
if(ui.size.width <= 225) {
|
169 |
+
$(".wcp-content").width(225);
|
170 |
+
wcp_settings.folder_width = 225;
|
171 |
+
}
|
172 |
+
}
|
173 |
+
});
|
174 |
+
|
175 |
+
$(document).on("contextmenu", ".jstree-anchor", function(e){
|
176 |
+
$(this).find("span.folder-inline-edit").trigger("click");
|
177 |
+
return false;
|
178 |
+
});
|
179 |
+
|
180 |
+
$(document).on("click", ".folder-actions span.folder-inline-edit", function(e){
|
181 |
+
e.stopImmediatePropagation()
|
182 |
+
e.stopPropagation();
|
183 |
+
if(wcp_settings.can_manage_folder == 0) {
|
184 |
+
return;
|
185 |
+
}
|
186 |
+
isHigh = $(this).closest("li.jstree-node").hasClass("is-high");
|
187 |
+
isSticky = $(this).closest("li.jstree-node").hasClass("is-sticky");
|
188 |
+
isStickyClass = (isSticky)?true:false;
|
189 |
+
$(".dynamic-menu").remove();
|
190 |
+
$(".active-menu").removeClass("active-menu");
|
191 |
+
menuHtml = "<div class='dynamic-menu'><ul>" +
|
192 |
+
"<li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li>" +
|
193 |
+
"<li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li>" +
|
194 |
+
"<li class='sticky-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span> Sticky Folder (Pro)</a></li>" +
|
195 |
+
"<li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>" + ((isHigh) ? " Remove Star" : "Add a Star") + "</a></li>"+
|
196 |
+
"<li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";
|
197 |
+
|
198 |
+
hasPosts = parseInt($(this).closest("a.jstree-anchor").find(".premio-folder-count").text());
|
199 |
+
if (wcp_settings.post_type == "attachment" && hasPosts) {
|
200 |
+
menuHtml += "<li target='_blank' class='download-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>";
|
201 |
+
}
|
202 |
+
menuHtml += "<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li>" +
|
203 |
+
"</ul></div>";
|
204 |
+
$(this).closest("a.jstree-anchor").after(menuHtml);
|
205 |
+
$(this).parents("li.jstree-node").addClass("active-menu");
|
206 |
+
if(($(this).offset().top + $(".dynamic-menu").height()) > ($(window).height() - 20)) {
|
207 |
+
$(".dynamic-menu").addClass("bottom-fix");
|
208 |
+
|
209 |
+
if($(".dynamic-menu.bottom-fix").offset().top < $("#custom-scroll-menu").offset().top) {
|
210 |
+
$(".dynamic-menu").removeClass("bottom-fix");
|
211 |
+
}
|
212 |
+
}
|
213 |
+
});
|
214 |
+
|
215 |
+
$(document).on("click", ".sticky-folders .sticky-fldr > a", function(e) {
|
216 |
+
e.stopPropagation();
|
217 |
+
var folder_ID = $(this).closest("li").data("folder-id");
|
218 |
+
if($(".jstree-node[id='"+folder_ID+"']").length) {
|
219 |
+
$(".jstree-clicked").removeClass("jstree-clicked");
|
220 |
+
$(".active-item").removeClass("active-item");
|
221 |
+
$("#js-tree-menu").jstree('select_node', activeRecordID);
|
222 |
+
$(".jstree-node[id='"+folder_ID+"'] > a.jstree-anchor").trigger("click");
|
223 |
+
$(".jstree-node[id='"+folder_ID+"'] > a.jstree-anchor").addClass("jstree-clicked");
|
224 |
+
$(".sticky-folders .sticky-folder-"+folder_ID+" a").addClass("active-item");
|
225 |
+
}
|
226 |
+
});
|
227 |
+
|
228 |
+
$(document).on("contextmenu", ".sticky-folders li .sticky-fldr > a", function(e){
|
229 |
+
$(this).find("span.update-inline-record").trigger("click");
|
230 |
+
return false;
|
231 |
+
});
|
232 |
+
|
233 |
+
$(document).on("click", ".update-inline-record", function(e){
|
234 |
+
e.stopImmediatePropagation()
|
235 |
+
e.stopPropagation();
|
236 |
+
if(wcp_settings.can_manage_folder == 0) {
|
237 |
+
return;
|
238 |
+
}
|
239 |
+
isHigh = $(this).closest("li.sticky-fldr").hasClass("is-high");
|
240 |
+
isSticky = $(this).closest("li.sticky-fldr").hasClass("is-sticky");
|
241 |
+
isStickyClass = (isSticky)?true:false;
|
242 |
+
$(".dynamic-menu").remove();
|
243 |
+
$(".active-menu").removeClass("active-menu");
|
244 |
+
menuHtml = "<div class='dynamic-menu'><ul>" +
|
245 |
+
"<li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li>" +
|
246 |
+
"<li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li>" +
|
247 |
+
"<li class='sticky-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li>" +
|
248 |
+
"<li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>" + ((isHigh) ? " Remove Star" : "Add a Star") + "</a></li>"+
|
249 |
+
"<li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";
|
250 |
+
|
251 |
+
hasPosts = parseInt($(this).closest("li.jstree-node").find("h3.title:first > .total-count").text());
|
252 |
+
if (wcp_settings.post_type == "attachment" && hasPosts) {
|
253 |
+
menuHtml += "<li class='download-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>";
|
254 |
+
}
|
255 |
+
menuHtml += "<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li>" +
|
256 |
+
"</ul></div>";
|
257 |
+
$(this).closest("li").append(menuHtml);
|
258 |
+
if(($(this).offset().top + $(".dynamic-menu").height()) > ($(window).height() - 20)) {
|
259 |
+
$(".dynamic-menu").addClass("bottom-fix");
|
260 |
+
|
261 |
+
if($(".dynamic-menu.bottom-fix").offset().top < $("#custom-scroll-menu").offset().top) {
|
262 |
+
$(".dynamic-menu").removeClass("bottom-fix");
|
263 |
+
}
|
264 |
+
}
|
265 |
+
});
|
266 |
+
|
267 |
+
$(document).on("click", ".dynamic-menu", function(e){
|
268 |
+
e.stopImmediatePropagation()
|
269 |
+
e.stopPropagation();
|
270 |
+
});
|
271 |
+
|
272 |
+
$(document).on("click", "body, html", function(){
|
273 |
+
$(".dynamic-menu").remove();
|
274 |
+
});
|
275 |
+
|
276 |
+
$(".wcp-hide-show-buttons .toggle-buttons").click(function(){
|
277 |
+
var folderStatus = "show";
|
278 |
+
if($(this).hasClass("hide-folders")) {
|
279 |
+
folderStatus = "hide";
|
280 |
+
}
|
281 |
+
$(".wcp-hide-show-buttons .toggle-buttons").toggleClass("active");
|
282 |
+
nonce = wcp_settings.nonce;
|
283 |
+
if(folderStatus == "show") {
|
284 |
+
$("#wcp-content").addClass("no-transition");
|
285 |
+
$("#wcp-content").removeClass("hide-folders-area");
|
286 |
+
if(wcp_settings.isRTL == "1") {
|
287 |
+
$("#wpcontent").css("padding-right", (wcp_settings.folder_width + 20) + "px");
|
288 |
+
$("#wpcontent").css("padding-left", "0px");
|
289 |
+
} else {
|
290 |
+
$("#wpcontent").css("padding-left", (wcp_settings.folder_width + 20) + "px");
|
291 |
+
}
|
292 |
+
setTimeout(function(){
|
293 |
+
$("#wcp-content").removeClass("no-transition");
|
294 |
+
}, 250);
|
295 |
+
} else {
|
296 |
+
$("#wcp-content").addClass("hide-folders-area");
|
297 |
+
if(wcp_settings.isRTL == "1") {
|
298 |
+
$("#wpcontent").css("padding-right", "20px");
|
299 |
+
$("#wpcontent").css("padding-left", "0px");
|
300 |
+
} else {
|
301 |
+
$("#wpcontent").css("padding-left", "20px");
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
$.ajax({
|
306 |
+
url: wcp_settings.ajax_url,
|
307 |
+
data: "type=" + wcp_settings.post_type + "&action=wcp_change_folder_display_status&status=" + folderStatus +"&nonce="+nonce,
|
308 |
+
method: 'post',
|
309 |
+
success: function (res) {
|
310 |
+
setStickyHeaderForMedia();
|
311 |
+
}
|
312 |
+
});
|
313 |
+
});
|
314 |
+
|
315 |
+
/* grag and drop */
|
316 |
+
$(".jstree-anchor").livequery(function(){
|
317 |
+
$(this).droppable({
|
318 |
+
accept: ".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",
|
319 |
+
hoverClass: 'wcp-drop-hover',
|
320 |
+
classes: {
|
321 |
+
"ui-droppable-active": "ui-state-highlight"
|
322 |
+
},
|
323 |
+
drop: function( event, ui ) {
|
324 |
+
folderID = $(this).closest("li.jstree-node").attr('id');
|
325 |
+
if ( ui.draggable.hasClass( 'wcp-move-multiple')) {
|
326 |
+
if($(".wp-list-table input:checked").length) {
|
327 |
+
chkStr = "";
|
328 |
+
$(".wp-list-table input:checked").each(function(){
|
329 |
+
chkStr += $(this).val()+",";
|
330 |
+
});
|
331 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
332 |
+
$.ajax({
|
333 |
+
url: wcp_settings.ajax_url,
|
334 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
335 |
+
method: 'post',
|
336 |
+
success: function (res) {
|
337 |
+
res = $.parseJSON(res);
|
338 |
+
if(res.status == "1") {
|
339 |
+
resetMediaAndPosts();
|
340 |
+
} else {
|
341 |
+
$(".folder-popup-form").hide();
|
342 |
+
$(".folder-popup-form").removeClass("disabled");
|
343 |
+
$("#error-folder-popup-message").html(res.message);
|
344 |
+
$("#error-folder-popup").show()
|
345 |
+
}
|
346 |
+
}
|
347 |
+
});
|
348 |
+
}
|
349 |
+
} else if( ui.draggable.hasClass( 'wcp-move-file' ) ){
|
350 |
+
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
351 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
352 |
+
chkStr = postID+",";
|
353 |
+
$(".wp-list-table input:checked").each(function(){
|
354 |
+
if($(this).val() != postID) {
|
355 |
+
chkStr += $(this).val() + ",";
|
356 |
+
}
|
357 |
+
});
|
358 |
+
$.ajax({
|
359 |
+
url: wcp_settings.ajax_url,
|
360 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
361 |
+
method: 'post',
|
362 |
+
success: function (res) {
|
363 |
+
res = $.parseJSON(res);
|
364 |
+
if(res.status == "1") {
|
365 |
+
// window.location.reload();
|
366 |
+
resetMediaAndPosts();
|
367 |
+
} else {
|
368 |
+
$(".folder-popup-form").hide();
|
369 |
+
$(".folder-popup-form").removeClass("disabled");
|
370 |
+
$("#error-folder-popup-message").html(res.message);
|
371 |
+
$("#error-folder-popup").show()
|
372 |
+
}
|
373 |
+
}
|
374 |
+
});
|
375 |
+
} else if (ui.draggable.hasClass('attachment')) {
|
376 |
+
chkStr = ui.draggable[0].attributes['data-id'].nodeValue;
|
377 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
378 |
+
if ($(".attachments-browser li.attachment.selected").length > 1) {
|
379 |
+
chkStr = "";
|
380 |
+
$(".attachments-browser li.attachment.selected").each(function(){
|
381 |
+
chkStr += $(this).data("id") + ",";
|
382 |
+
});
|
383 |
+
}
|
384 |
+
folderIDs = chkStr;
|
385 |
+
$.ajax({
|
386 |
+
url: wcp_settings.ajax_url,
|
387 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
388 |
+
method: 'post',
|
389 |
+
success: function (res) {
|
390 |
+
// window.location.reload();
|
391 |
+
resetMediaAndPosts();
|
392 |
+
}
|
393 |
+
});
|
394 |
+
}
|
395 |
+
}
|
396 |
+
});
|
397 |
+
});
|
398 |
+
|
399 |
+
$(".un-categorised-items").livequery(function(){
|
400 |
+
$(this).droppable({
|
401 |
+
accept: ".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",
|
402 |
+
hoverClass: 'wcp-hover-list',
|
403 |
+
classes: {
|
404 |
+
"ui-droppable-active": "ui-state-highlight"
|
405 |
+
},
|
406 |
+
drop: function (event, ui) {
|
407 |
+
folderID = -1;
|
408 |
+
nonce = wcp_settings.nonce;
|
409 |
+
if (ui.draggable.hasClass('wcp-move-multiple')) {
|
410 |
+
if ($(".wp-list-table input:checked").length) {
|
411 |
+
chkStr = "";
|
412 |
+
$(".wp-list-table input:checked").each(function(){
|
413 |
+
chkStr += $(this).val() + ",";
|
414 |
+
});
|
415 |
+
$.ajax({
|
416 |
+
url: wcp_settings.ajax_url,
|
417 |
+
data: "post_id=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
418 |
+
method: 'post',
|
419 |
+
success: function (res) {
|
420 |
+
//window.location.reload();
|
421 |
+
resetMediaAndPosts();
|
422 |
+
}
|
423 |
+
});
|
424 |
+
}
|
425 |
+
} else if (ui.draggable.hasClass('wcp-move-file')) {
|
426 |
+
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
427 |
+
chkStr = postID+",";
|
428 |
+
$(".wp-list-table input:checked").each(function(){
|
429 |
+
if(postID != $(this).val()) {
|
430 |
+
chkStr += $(this).val() + ",";
|
431 |
+
}
|
432 |
+
});
|
433 |
+
$.ajax({
|
434 |
+
url: wcp_settings.ajax_url,
|
435 |
+
data: "post_id=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
436 |
+
method: 'post',
|
437 |
+
success: function (res) {
|
438 |
+
//window.location.reload();
|
439 |
+
resetMediaAndPosts();
|
440 |
+
}
|
441 |
+
});
|
442 |
+
} else if (ui.draggable.hasClass('attachment')) {
|
443 |
+
chkStr = ui.draggable[0].attributes['data-id'].nodeValue;
|
444 |
+
if ($(".attachments-browser li.attachment.selected").length > 1) {
|
445 |
+
chkStr = "";
|
446 |
+
$(".attachments-browser li.attachment.selected").each(function(){
|
447 |
+
chkStr += $(this).data("id") + ",";
|
448 |
+
});
|
449 |
+
}
|
450 |
+
folderIDs = chkStr;
|
451 |
+
$.ajax({
|
452 |
+
url: wcp_settings.ajax_url,
|
453 |
+
data: "post_id=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
454 |
+
method: 'post',
|
455 |
+
success: function (res) {
|
456 |
+
// window.location.reload();
|
457 |
+
resetMediaAndPosts();
|
458 |
+
}
|
459 |
+
});
|
460 |
+
}
|
461 |
+
}
|
462 |
+
});
|
463 |
+
});
|
464 |
+
|
465 |
+
$(".attachments-browser li.attachment").livequery(function(){
|
466 |
+
$(this).draggable({
|
467 |
+
revert: "invalid",
|
468 |
+
containment: "document",
|
469 |
+
helper: function (event, ui) {
|
470 |
+
$(".selected-items").remove();
|
471 |
+
selectedItems = $(".attachments-browser li.attachment.selected").length;
|
472 |
+
selectedItems = (selectedItems == 0 || selectedItems == 1) ? "1 Item" : selectedItems + " Items";
|
473 |
+
return $("<div class='selected-items'><span class='total-post-count'>" + selectedItems + " Selected</span></div>");
|
474 |
+
},
|
475 |
+
start: function( event, ui){
|
476 |
+
$("body").addClass("no-hover-css");
|
477 |
+
},
|
478 |
+
cursor: "move",
|
479 |
+
cursorAt: {
|
480 |
+
left: 0,
|
481 |
+
top: 0
|
482 |
+
},
|
483 |
+
stop: function( event, ui ) {
|
484 |
+
$(".selected-items").remove();
|
485 |
+
$("body").removeClass("no-hover-css");
|
486 |
+
}
|
487 |
+
});
|
488 |
+
});
|
489 |
+
|
490 |
+
$(".tree-structure .folder-item").livequery(function(){
|
491 |
+
$(this).droppable({
|
492 |
+
accept: ".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",
|
493 |
+
hoverClass: 'wcp-drop-hover-list',
|
494 |
+
classes: {
|
495 |
+
"ui-droppable-active": "ui-state-highlight"
|
496 |
+
},
|
497 |
+
drop: function( event, ui ) {
|
498 |
+
$("body").removeClass("no-hover-css");
|
499 |
+
folderID = $(this).data('id');
|
500 |
+
if ( ui.draggable.hasClass( 'wcp-move-multiple' ) ) {
|
501 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
502 |
+
if($(".wp-list-table input:checked").length) {
|
503 |
+
chkStr = "";
|
504 |
+
$(".wp-list-table input:checked").each(function(){
|
505 |
+
chkStr += $(this).val()+",";
|
506 |
+
});
|
507 |
+
$.ajax({
|
508 |
+
url: wcp_settings.ajax_url,
|
509 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
510 |
+
method: 'post',
|
511 |
+
success: function (res) {
|
512 |
+
// window.location.reload();
|
513 |
+
resetMediaAndPosts();
|
514 |
+
ajaxAnimation();
|
515 |
+
}
|
516 |
+
});
|
517 |
+
}
|
518 |
+
} else if ( ui.draggable.hasClass( 'wcp-move-file' ) ) {
|
519 |
+
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
520 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
521 |
+
chkStr = postID+",";
|
522 |
+
$(".wp-list-table input:checked").each(function(){
|
523 |
+
if($(this).val() != postID) {
|
524 |
+
chkStr += $(this).val() + ",";
|
525 |
+
}
|
526 |
+
});
|
527 |
+
$.ajax({
|
528 |
+
url: wcp_settings.ajax_url,
|
529 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
530 |
+
method: 'post',
|
531 |
+
success: function (res) {
|
532 |
+
// window.location.reload();
|
533 |
+
resetMediaAndPosts();
|
534 |
+
ajaxAnimation();
|
535 |
+
}
|
536 |
+
});
|
537 |
+
} else if( ui.draggable.hasClass( 'attachment' ) ){
|
538 |
+
chkStr = ui.draggable[0].attributes['data-id'].nodeValue;
|
539 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
540 |
+
if($(".attachments-browser li.attachment.selected").length > 1) {
|
541 |
+
chkStr = "";
|
542 |
+
$(".attachments-browser li.attachment.selected").each(function(){
|
543 |
+
chkStr += $(this).data("id")+",";
|
544 |
+
});
|
545 |
+
}
|
546 |
+
$.ajax({
|
547 |
+
url: wcp_settings.ajax_url,
|
548 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
549 |
+
method: 'post',
|
550 |
+
success: function (res) {
|
551 |
+
// window.location.reload();
|
552 |
+
resetMediaAndPosts();
|
553 |
+
ajaxAnimation();
|
554 |
+
}
|
555 |
+
});
|
556 |
+
}
|
557 |
+
}
|
558 |
+
});
|
559 |
+
});
|
560 |
+
|
561 |
+
$(".sticky-folders li a").livequery(function(){
|
562 |
+
$(this).droppable({
|
563 |
+
accept: ".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",
|
564 |
+
hoverClass: 'wcp-drop-hover',
|
565 |
+
classes: {
|
566 |
+
"ui-droppable-active": "ui-state-highlight"
|
567 |
+
},
|
568 |
+
drop: function( event, ui ) {
|
569 |
+
folderID = $(this).closest("li").data('folder-id');
|
570 |
+
if ( ui.draggable.hasClass( 'wcp-move-multiple' ) ) {
|
571 |
+
if($(".wp-list-table input:checked").length) {
|
572 |
+
chkStr = "";
|
573 |
+
$(".wp-list-table input:checked").each(function(){
|
574 |
+
chkStr += $(this).val()+",";
|
575 |
+
});
|
576 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
577 |
+
jQuery.ajax({
|
578 |
+
url: wcp_settings.ajax_url,
|
579 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
580 |
+
method: 'post',
|
581 |
+
success: function (res) {
|
582 |
+
res = jQuery.parseJSON(res);
|
583 |
+
if(res.status == "1") {
|
584 |
+
resetMediaAndPosts();
|
585 |
+
ajaxAnimation();
|
586 |
+
} else {
|
587 |
+
$(".folder-popup-form").hide();
|
588 |
+
$(".folder-popup-form").removeClass("disabled");
|
589 |
+
$("#error-folder-popup-message").html(res.message);
|
590 |
+
$("#error-folder-popup").show()
|
591 |
+
}
|
592 |
+
}
|
593 |
+
});
|
594 |
+
}
|
595 |
+
} else if( ui.draggable.hasClass( 'wcp-move-file' ) ){
|
596 |
+
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
597 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
598 |
+
chkStr = postID+",";
|
599 |
+
$(".wp-list-table input:checked").each(function(){
|
600 |
+
if($(this).val() != postID) {
|
601 |
+
chkStr += $(this).val() + ",";
|
602 |
+
}
|
603 |
+
});
|
604 |
+
jQuery.ajax({
|
605 |
+
url: wcp_settings.ajax_url,
|
606 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
607 |
+
method: 'post',
|
608 |
+
success: function (res) {
|
609 |
+
res = jQuery.parseJSON(res);
|
610 |
+
if(res.status == "1") {
|
611 |
+
// window.location.reload();
|
612 |
+
resetMediaAndPosts();
|
613 |
+
ajaxAnimation();
|
614 |
+
} else {
|
615 |
+
$(".folder-popup-form").hide();
|
616 |
+
$(".folder-popup-form").removeClass("disabled");
|
617 |
+
$("#error-folder-popup-message").html(res.message);
|
618 |
+
$("#error-folder-popup").show()
|
619 |
+
}
|
620 |
+
}
|
621 |
+
});
|
622 |
+
} else if (ui.draggable.hasClass('attachment')) {
|
623 |
+
chkStr = ui.draggable[0].attributes['data-id'].nodeValue;
|
624 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
625 |
+
if ($(".attachments-browser li.attachment.selected").length > 1) {
|
626 |
+
chkStr = "";
|
627 |
+
$(".attachments-browser li.attachment.selected").each(function () {
|
628 |
+
chkStr += $(this).data("id") + ",";
|
629 |
+
});
|
630 |
+
}
|
631 |
+
folderIDs = chkStr;
|
632 |
+
jQuery.ajax({
|
633 |
+
url: wcp_settings.ajax_url,
|
634 |
+
data: "post_ids=" + chkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
635 |
+
method: 'post',
|
636 |
+
success: function (res) {
|
637 |
+
// window.location.reload();
|
638 |
+
resetMediaAndPosts();
|
639 |
+
ajaxAnimation();
|
640 |
+
}
|
641 |
+
});
|
642 |
+
}
|
643 |
+
}
|
644 |
+
});
|
645 |
+
});
|
646 |
+
});
|
647 |
+
|
648 |
+
function setFolderCount() {
|
649 |
+
$("#js-tree-menu .jstree-node").each(function(){
|
650 |
+
var folderCount = parseInt($(this).data("count"));
|
651 |
+
if(folderCount > 0) {
|
652 |
+
$(".jstree-node[id='" + $(this).attr("id") + "'] > a span.premio-folder-count").text(folderCount);
|
653 |
+
}
|
654 |
+
|
655 |
+
var folderProperty = {
|
656 |
+
'folder_id': $(this).attr("id"),
|
657 |
+
'folder_count': folderCount,
|
658 |
+
'is_sticky': $(this).hasClass("is-sticky")?1:0,
|
659 |
+
'is_high': $(this).hasClass("is-high")?1:0,
|
660 |
+
'nonce': $(this).data("nonce"),
|
661 |
+
'slug': $(this).data("slug"),
|
662 |
+
'is_deleted': 0
|
663 |
+
};
|
664 |
+
folderPropertyArray.push(folderProperty);
|
665 |
+
});
|
666 |
+
|
667 |
+
if(activeRecordID != "" && activeRecordID != 0) {
|
668 |
+
if($(".jstree-node[id='"+activeRecordID+"']").length) {
|
669 |
+
$("#js-tree-menu").jstree('select_node', activeRecordID);
|
670 |
+
if($(".sticky-folders .sticky-folder-"+activeRecordID+" a").length) {
|
671 |
+
$(".sticky-folders .sticky-folder-" + activeRecordID + " a").addClass("active-item");
|
672 |
+
}
|
673 |
+
}
|
674 |
+
}
|
675 |
+
$(".ajax-preloader").hide();
|
676 |
+
$(".js-tree-data").show();
|
677 |
+
setCustomScrollForFolder();
|
678 |
+
make_sticky_folder_menu();
|
679 |
+
if($(".sticky-folders ul > li").length > 0) {
|
680 |
+
$(".sticky-folders").addClass("active");
|
681 |
+
}
|
682 |
+
add_active_item_to_list();
|
683 |
+
}
|
684 |
+
|
685 |
+
function getSettingForPost(postId, filedName) {
|
686 |
+
if(folderPropertyArray.length > 0) {
|
687 |
+
for(i=0; i<folderPropertyArray.length; i++) {
|
688 |
+
if(parseInt(folderPropertyArray[i]['folder_id']) == parseInt(postId)) {
|
689 |
+
return folderPropertyArray[i][filedName];
|
690 |
+
}
|
691 |
+
}
|
692 |
+
}
|
693 |
+
return "";
|
694 |
+
}
|
695 |
+
|
696 |
+
function getIndexForPostSetting(postId) {
|
697 |
+
if(folderPropertyArray.length > 0) {
|
698 |
+
for(i=0; i<folderPropertyArray.length; i++) {
|
699 |
+
if(parseInt(folderPropertyArray[i]['folder_id']) == parseInt(postId)) {
|
700 |
+
return i;
|
701 |
+
}
|
702 |
+
}
|
703 |
+
}
|
704 |
+
return null;
|
705 |
+
}
|
706 |
+
|
707 |
+
function resetMediaAndPosts() {
|
708 |
+
if($(".media-toolbar").hasClass("media-toolbar-mode-select")) {
|
709 |
+
if($("ul.attachments li.selected").length) {
|
710 |
+
$("ul.attachments li.selected").trigger("click");
|
711 |
+
$(".select-mode-toggle-button").trigger("click");
|
712 |
+
}
|
713 |
+
}
|
714 |
+
if(folderIDs != "" && ($("#js-tree-menu a.jstree-clicked").length > 0 || activeRecordID == "-1")) {
|
715 |
+
if($("#media-attachment-taxonomy-filter").length) {
|
716 |
+
folderIDs = folderIDs.split(",");
|
717 |
+
for (var i = 0; i < folderIDs.length; i++) {
|
718 |
+
if(folderIDs[i] != "") {
|
719 |
+
$(".attachments-browser li[data-id='"+folderIDs[i]+"']").remove();
|
720 |
+
}
|
721 |
+
}
|
722 |
+
}
|
723 |
+
folderIDs = "";
|
724 |
+
}
|
725 |
+
if($("#media-attachment-taxonomy-filter").length) {
|
726 |
+
resetMediaData(0);
|
727 |
+
} else {
|
728 |
+
$.ajax({
|
729 |
+
url: wcp_settings.ajax_url,
|
730 |
+
data: "type=" + wcp_settings.post_type + "&action=get_folders_default_list",
|
731 |
+
method: 'post',
|
732 |
+
success: function (res) {
|
733 |
+
res = $.parseJSON(res);
|
734 |
+
// $("#js-tree-menu > ul#space_0").html(res.data);
|
735 |
+
$(".header-posts .total-count").text(res.total_items);
|
736 |
+
$(".un-categorised-items .total-count").text(res.empty_items);
|
737 |
+
|
738 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
739 |
+
if(!$("#title_"+res.taxonomies[i].term_id+" .total-count").length) {
|
740 |
+
$("#title_"+res.taxonomies[i].term_id+" .star-icon").before("<span class='total-count'></span>");
|
741 |
+
}
|
742 |
+
$("#title_"+res.taxonomies[i].term_id+" .total-count").text(parseInt(res.taxonomies[i].trash_count));
|
743 |
+
}
|
744 |
+
|
745 |
+
$("span.premio-folder-count").text("");
|
746 |
+
$(".folder-count").text("");
|
747 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
748 |
+
if(parseInt(res.taxonomies[i].trash_count) != 0) {
|
749 |
+
$(".jstree-node[id='" + res.taxonomies[i].term_id + "'] > a.jstree-anchor span.premio-folder-count").text(res.taxonomies[i].trash_count);
|
750 |
+
$(".sticky-folder-"+res.taxonomies[i].term_id+" .premio-folder-count").text(res.taxonomies[i].trash_count);
|
751 |
+
}
|
752 |
+
}
|
753 |
+
}
|
754 |
+
});
|
755 |
+
$(".folder-loader-ajax").addClass("active");
|
756 |
+
if($("#folder-posts-filter").length) {
|
757 |
+
$("#folder-posts-filter").load(folderCurrentURL + " #posts-filter", function(){
|
758 |
+
var obj = { Title: "", Url: folderCurrentURL };
|
759 |
+
history.pushState(obj, obj.Title, obj.Url);
|
760 |
+
if (wcp_settings.show_in_page == "show" && !$(".tree-structure").length) {
|
761 |
+
$(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>');
|
762 |
+
}
|
763 |
+
add_active_item_to_list();
|
764 |
+
triggerInlineUpdate();
|
765 |
+
});
|
766 |
+
} else {
|
767 |
+
$("#wpbody").load(folderCurrentURL + " #wpbody-content", false, function (res) {
|
768 |
+
var obj = { Title: "", Url: folderCurrentURL };
|
769 |
+
history.pushState(obj, obj.Title, obj.Url);
|
770 |
+
if (wcp_settings.show_in_page == "show" && !$(".tree-structure").length) {
|
771 |
+
$(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>');
|
772 |
+
}
|
773 |
+
add_active_item_to_list();
|
774 |
+
});
|
775 |
+
}
|
776 |
+
}
|
777 |
+
}
|
778 |
+
|
779 |
+
function triggerInlineUpdate() {
|
780 |
+
add_active_item_to_list();
|
781 |
+
|
782 |
+
$(".form-loader-count").css("width", "0");
|
783 |
+
if(typeof inlineEditPost == "object") {
|
784 |
+
|
785 |
+
inlineEditPost.init();
|
786 |
+
|
787 |
+
$("#the-list").on("click",".editinline",function(){
|
788 |
+
$(this).attr("aria-expanded","true");
|
789 |
+
inlineEditPost.edit(this);
|
790 |
+
});
|
791 |
+
$(document).on("click", ".inline-edit-save .save", function(){
|
792 |
+
var thisID = $(this).closest("tr").attr("id");
|
793 |
+
thisID = thisID.replace("edit-","");
|
794 |
+
thisID = thisID.replace("post-","");
|
795 |
+
inlineEditPost.save(thisID);
|
796 |
+
});
|
797 |
+
$(document).on("click", ".inline-edit-save .cancel", function(){
|
798 |
+
var thisID = $(this).closest("tr").attr("id");
|
799 |
+
thisID = thisID.replace("edit-","");
|
800 |
+
thisID = thisID.replace("post-","");
|
801 |
+
inlineEditPost.revert(thisID);
|
802 |
+
});
|
803 |
+
}
|
804 |
+
|
805 |
+
if(wcp_settings.post_type == "attachment") {
|
806 |
+
if(!$(".move-to-folder-top").length) {
|
807 |
+
$("#bulk-action-selector-top").append("<option class='move-to-folder-top' value='move_to_folder'>Move to Folder</option>");
|
808 |
+
}
|
809 |
+
if(!$(".move-to-folder-bottom").length) {
|
810 |
+
$("#bulk-action-selector-bottom").append("<option class='move-to-folder-bottom' value='move_to_folder'>Move to Folder</option>");
|
811 |
+
}
|
812 |
+
}
|
813 |
+
}
|
814 |
+
|
815 |
+
function add_active_item_to_list() {
|
816 |
+
|
817 |
+
if(folderPropertyArray.length) {
|
818 |
+
$("li.jstree-node").each(function(){
|
819 |
+
folderPostId = getIndexForPostSetting($(this).attr("id"));
|
820 |
+
if(folderPostId != null) {
|
821 |
+
if(folderPropertyArray[folderPostId]['is_high'] == 1) {
|
822 |
+
$(this).addClass("is-high");
|
823 |
+
} else {
|
824 |
+
$(this).removeClass("is-high");
|
825 |
+
}
|
826 |
+
if(folderPropertyArray[folderPostId]['is_sticky'] == 1) {
|
827 |
+
$(this).addClass("is-sticky");
|
828 |
+
} else {
|
829 |
+
$(this).removeClass("is-sticky");
|
830 |
+
}
|
831 |
+
}
|
832 |
+
});
|
833 |
+
}
|
834 |
+
|
835 |
+
folderId = 0;
|
836 |
+
$(".tree-structure ul").html("");
|
837 |
+
folderStatus = true;
|
838 |
+
if($(".jstree-clicked").length) {
|
839 |
+
folderID = $(".jstree-clicked").closest(".jstree-node").attr("id");
|
840 |
+
if($(".jstree-node[id='"+folderID+"'] > ul.jstree-children > li.jstree-node").length) {
|
841 |
+
folderStatus = false;
|
842 |
+
$(".jstree-node[id='"+folderID+"'] > ul.jstree-children > li.jstree-node").each(function(){
|
843 |
+
fID = $(this).attr("id");
|
844 |
+
fName = $.trim($("#js-tree-menu").jstree(true).get_node(fID).text);
|
845 |
+
liHtml = listFolderString.replace(/__folder_id__/g,fID);
|
846 |
+
liHtml = liHtml.replace(/__folder_name__/g,fName);
|
847 |
+
selectedClass = $(this).hasClass("is-high")?"is-high":"";
|
848 |
+
liHtml = liHtml.replace(/__append_class__/g,selectedClass);
|
849 |
+
$(".tree-structure ul").append(liHtml);
|
850 |
+
});
|
851 |
+
} else {
|
852 |
+
if(!$(".jstree-node[id='"+folderID+"']").closest("ul").hasClass("jstree-container-ul")) {
|
853 |
+
folderStatus = false;
|
854 |
+
}
|
855 |
+
}
|
856 |
+
}
|
857 |
+
if(folderStatus){
|
858 |
+
$("#js-tree-menu > ul > li.jstree-node").each(function(){
|
859 |
+
fID = $(this).attr("id");
|
860 |
+
fName = $.trim($("#js-tree-menu").jstree(true).get_node(fID).text);
|
861 |
+
liHtml = listFolderString.replace(/__folder_id__/g,fID);
|
862 |
+
liHtml = liHtml.replace(/__folder_name__/g,fName);
|
863 |
+
selectedClass = $(this).hasClass("is-high")?"is-high":"";
|
864 |
+
liHtml = liHtml.replace(/__append_class__/g,selectedClass);
|
865 |
+
$(".tree-structure ul").append(liHtml);
|
866 |
+
});
|
867 |
+
}
|
868 |
+
|
869 |
+
|
870 |
+
apply_animation_height();
|
871 |
+
|
872 |
+
if(wcp_settings.post_type == "attachment") {
|
873 |
+
if(!$(".move-to-folder-top").length) {
|
874 |
+
$("#bulk-action-selector-top").append("<option class='move-to-folder-top' value='move_to_folder'>Move to Folder</option>");
|
875 |
+
}
|
876 |
+
if(!$(".move-to-folder-bottom").length) {
|
877 |
+
$("#bulk-action-selector-bottom").append("<option class='move-to-folder-bottom' value='move_to_folder'>Move to Folder</option>");
|
878 |
+
}
|
879 |
+
}
|
880 |
+
|
881 |
+
$(".sticky-folders .active-item").removeClass("active-item");
|
882 |
+
if($("#js-tree-menu li.jstree-node.active-item").length) {
|
883 |
+
var activeTermId = $("#js-tree-menu li.jstree-node.active-item").data("folder-id");
|
884 |
+
$(".sticky-folders .sticky-folder-"+activeTermId+" a").addClass("active-item");
|
885 |
+
}
|
886 |
+
}
|
887 |
+
|
888 |
+
$(window).on("resize", function(){
|
889 |
+
setCustomScrollForFolder();
|
890 |
+
setStickyHeaderForMedia();
|
891 |
+
});
|
892 |
+
|
893 |
+
$(window).scroll(function(){
|
894 |
+
setStickyHeaderForMedia()
|
895 |
+
});
|
896 |
+
|
897 |
+
function setCustomScrollForFolder() {
|
898 |
+
/*contentHeight = $(window).height() - $("#wpadminbar").height() - $(".sticky-wcp-custom-form").height() - 30;
|
899 |
+
var scrollTop = 0;
|
900 |
+
if($("#custom-scroll-menu").hasClass("mCustomScrollbar")) {
|
901 |
+
var $scrollerOuter = $( '#custom-scroll-menu' );
|
902 |
+
var $dragger = $scrollerOuter.find( '.mCSB_dragger' );
|
903 |
+
var scrollHeight = $scrollerOuter.find( '.mCSB_container' ).height();
|
904 |
+
var draggerTop = $dragger.position().top;
|
905 |
+
|
906 |
+
scrollTop = draggerTop / ($scrollerOuter.height() - $dragger.height()) * (scrollHeight - $scrollerOuter.height());
|
907 |
+
$("#custom-scroll-menu").mCustomScrollbar('destroy');
|
908 |
+
|
909 |
+
}
|
910 |
+
$("#custom-scroll-menu").mCustomScrollbar({
|
911 |
+
axis:"y",
|
912 |
+
scrollButtons:{enable:false},
|
913 |
+
setHeight: contentHeight,
|
914 |
+
theme:"3d",
|
915 |
+
scrollbarPosition:"inside",
|
916 |
+
});
|
917 |
+
if(scrollTop != 0) {
|
918 |
+
$("#custom-scroll-menu").mCustomScrollbar("scrollTo", scrollTop+"px",{scrollInertia:0});
|
919 |
+
}*/
|
920 |
+
}
|
921 |
+
|
922 |
+
/* add folder code */
|
923 |
+
$(document).ready(function(){
|
924 |
+
$("#add-new-folder").livequery(function(){
|
925 |
+
$(this).click(function() {
|
926 |
+
if($("#js-tree-menu a.jstree-clicked").length) {
|
927 |
+
fileFolderID = $("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id");
|
928 |
+
} else {
|
929 |
+
fileFolderID = 0;
|
930 |
+
}
|
931 |
+
isItFromMedia = false;
|
932 |
+
addFolder();
|
933 |
+
});
|
934 |
+
});
|
935 |
+
|
936 |
+
$(".new-folder").livequery(function(){
|
937 |
+
$(this).click(function() {
|
938 |
+
if($(this).closest("li.jstree-node").length) {
|
939 |
+
fileFolderID = $(this).closest("li.jstree-node").attr("id");
|
940 |
+
} else {
|
941 |
+
fileFolderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
942 |
+
}
|
943 |
+
isItFromMedia = false;
|
944 |
+
addFolder();
|
945 |
+
});
|
946 |
+
});
|
947 |
+
|
948 |
+
$(".duplicate-folder").livequery(function(){
|
949 |
+
$(this).click(function(e) {
|
950 |
+
e.stopPropagation();
|
951 |
+
if($(this).closest("li.jstree-node").length) {
|
952 |
+
fileFolderID = $(this).closest("li.jstree-node").attr("id");
|
953 |
+
} else {
|
954 |
+
fileFolderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
955 |
+
}
|
956 |
+
$(".dynamic-menu").remove();
|
957 |
+
isItFromMedia = false;
|
958 |
+
isDuplicate = true;
|
959 |
+
addFolder();
|
960 |
+
add_menu_to_list();
|
961 |
+
});
|
962 |
+
});
|
963 |
+
|
964 |
+
$(document).on("submit", "#save-folder-form", function(e){
|
965 |
+
e.stopPropagation();
|
966 |
+
e.preventDefault();
|
967 |
+
|
968 |
+
folderNameDynamic = $.trim($("#add-update-folder-name").val());
|
969 |
+
|
970 |
+
if($.trim(folderNameDynamic) == "") {
|
971 |
+
$(".folder-form-errors").addClass("active");
|
972 |
+
$("#add-update-folder-name").focus();
|
973 |
+
} else {
|
974 |
+
$("#save-folder-data").html('<span class="dashicons dashicons-update"></span>');
|
975 |
+
$("#add-update-folder").addClass("disabled");
|
976 |
+
|
977 |
+
var parentId = fileFolderID;
|
978 |
+
if(isItFromMedia) {
|
979 |
+
parentId = 0;
|
980 |
+
}
|
981 |
+
|
982 |
+
if(parentId == 0) {
|
983 |
+
folderOrder = $("#js-tree-menu > ul > li.jstree-node").length;
|
984 |
+
} else {
|
985 |
+
folderOrder = $("#js-tree-menu > ul > li.jstree-node[id='"+parentId+"'] > ul.jstree-children > li").length + 1;
|
986 |
+
}
|
987 |
+
|
988 |
+
$.ajax({
|
989 |
+
url: wcp_settings.ajax_url,
|
990 |
+
data: {
|
991 |
+
parent_id: parentId,
|
992 |
+
type: wcp_settings.post_type,
|
993 |
+
action: "wcp_add_new_folder",
|
994 |
+
nonce: wcp_settings.nonce,
|
995 |
+
term_id: parentId,
|
996 |
+
order: folderOrder,
|
997 |
+
name: folderNameDynamic,
|
998 |
+
is_duplicate: isDuplicate,
|
999 |
+
duplicate_from: duplicateFolderId
|
1000 |
+
},
|
1001 |
+
method: 'post',
|
1002 |
+
success: function (res) {
|
1003 |
+
result = $.parseJSON(res);
|
1004 |
+
if (result.status == '1') {
|
1005 |
+
isKeyActive = parseInt(result.is_key_active);
|
1006 |
+
n_o_file = parseInt(result.folders);
|
1007 |
+
$("#current-folder").text(n_o_file);
|
1008 |
+
$("#ttl-fldr").text((4*4)-(2*2)-2);
|
1009 |
+
checkForExpandCollapse();
|
1010 |
+
add_menu_to_list();
|
1011 |
+
$(".folder-popup-form").hide();
|
1012 |
+
$(".folder-popup-form").removeClass("disabled");
|
1013 |
+
var folderProperty = {
|
1014 |
+
'folder_id': result.term_id,
|
1015 |
+
'folder_count': 0,
|
1016 |
+
'is_sticky': 0,
|
1017 |
+
'is_high': 0,
|
1018 |
+
'nonce': result.nonce,
|
1019 |
+
'slug': result.slug,
|
1020 |
+
'is_deleted': 0
|
1021 |
+
};
|
1022 |
+
folderPropertyArray.push(folderProperty);
|
1023 |
+
ajaxAnimation();
|
1024 |
+
make_sticky_folder_menu();
|
1025 |
+
$('#js-tree-menu').jstree().create_node(result.parent_id, { "id" : result.term_id, "text" : " "+result.title }, "last", function(){
|
1026 |
+
$(".jstree-node[id='"+result.term_id+"']").attr("data-nonce", result.nonce);
|
1027 |
+
$(".jstree-node[id='"+result.term_id+"']").attr("data-slug", result.slug);
|
1028 |
+
});
|
1029 |
+
if($("#media-attachment-taxonomy-filter").length) {
|
1030 |
+
fileFolderID = result.term_id;
|
1031 |
+
resetMediaData(0);
|
1032 |
+
}
|
1033 |
+
} else {
|
1034 |
+
$(".folder-popup-form").hide();
|
1035 |
+
$(".folder-popup-form").removeClass("disabled");
|
1036 |
+
$("#error-folder-popup-message").html(result.message);
|
1037 |
+
$("#error-folder-popup").show();
|
1038 |
+
}
|
1039 |
+
}
|
1040 |
+
});
|
1041 |
+
}
|
1042 |
+
return false;
|
1043 |
+
});
|
1044 |
+
});
|
1045 |
+
|
1046 |
+
function add_menu_to_list() {
|
1047 |
+
add_active_item_to_list();
|
1048 |
+
}
|
1049 |
+
|
1050 |
+
function addFolder() {
|
1051 |
+
if(isKeyActive == 0 && n_o_file >= ((4*4)-(3*3)+(4/4)+(8/(2*2)))) {
|
1052 |
+
$("#folder-limitation-message").html("You've "+"reached the "+((4*4)-(2*2)-2)+" folder limitation!");
|
1053 |
+
$("#no-more-folder-credit").show();
|
1054 |
+
return false;
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
$("#add-update-folder-title").text("Add new folder");
|
1058 |
+
$("#save-folder-data").text("Submit");
|
1059 |
+
$(".folder-form-errors").removeClass("active");
|
1060 |
+
$("#add-update-folder-name").val("");
|
1061 |
+
if(isDuplicate) {
|
1062 |
+
duplicateFolderId = fileFolderID;
|
1063 |
+
$("#add-update-folder-name").val($.trim($("#js-tree-menu").jstree(true).get_node(fileFolderID).text)+ " #2");
|
1064 |
+
if($("#"+fileFolderID+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")) {
|
1065 |
+
fileFolderID = $("#"+fileFolderID+"_anchor").closest(".jstree-node").parent().parent().attr("id");
|
1066 |
+
} else {
|
1067 |
+
fileFolderID = 0;
|
1068 |
+
}
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
$("#add-update-folder").removeClass("disabled");
|
1072 |
+
$("#add-update-folder").show();
|
1073 |
+
$("#add-update-folder-name").focus();
|
1074 |
+
$(".dynamic-menu").remove();
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
/* update folder code */
|
1078 |
+
$(document).ready(function(){
|
1079 |
+
$("#inline-update").click(function(){
|
1080 |
+
if($("#js-tree-menu a.jstree-clicked").length) {
|
1081 |
+
fileFolderID = $("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id");
|
1082 |
+
updateFolder();
|
1083 |
+
//add_menu_to_list();
|
1084 |
+
}
|
1085 |
+
});
|
1086 |
+
|
1087 |
+
$(".rename-folder").livequery(function(){
|
1088 |
+
$(this).click(function(e){
|
1089 |
+
e.stopPropagation();
|
1090 |
+
if($(this).closest("li.jstree-node").length) {
|
1091 |
+
fileFolderID = $(this).closest("li.jstree-node").attr("id");
|
1092 |
+
} else {
|
1093 |
+
fileFolderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
1094 |
+
}
|
1095 |
+
updateFolder();
|
1096 |
+
$(".dynamic-menu").remove();
|
1097 |
+
});
|
1098 |
+
});
|
1099 |
+
|
1100 |
+
$(document).on("click", ".form-cancel-btn", function(){
|
1101 |
+
$(".folder-popup-form").hide();
|
1102 |
+
});
|
1103 |
+
|
1104 |
+
$(document).on("click", ".folder-popup-form", function (e) {
|
1105 |
+
$(".folder-popup-form").hide();
|
1106 |
+
});
|
1107 |
+
|
1108 |
+
$(document).on("click", ".popup-form-content", function (e) {
|
1109 |
+
e.stopPropagation();
|
1110 |
+
});
|
1111 |
+
|
1112 |
+
$(document).on("submit", "#update-folder-form", function(e){
|
1113 |
+
e.stopPropagation();
|
1114 |
+
e.preventDefault();
|
1115 |
+
|
1116 |
+
folderNameDynamic = $("#update-folder-item-name").val();
|
1117 |
+
|
1118 |
+
if($.trim(folderNameDynamic) == "") {
|
1119 |
+
$(".folder-form-errors").addClass("active");
|
1120 |
+
$("#update-folder-item-name").focus();
|
1121 |
+
} else {
|
1122 |
+
$("#update-folder-data").html('<span class="dashicons dashicons-update"></span>');
|
1123 |
+
$("#update-folder-item").addClass("disabled");
|
1124 |
+
|
1125 |
+
nonce = getSettingForPost(fileFolderID, 'nonce');
|
1126 |
+
parentID = $(".jstree-node[id='"+fileFolderID+"']").closest("li.jstree-node").attr("id");
|
1127 |
+
if (parentID == undefined) {
|
1128 |
+
parentID = 0;
|
1129 |
+
}
|
1130 |
+
$.ajax({
|
1131 |
+
url: wcp_settings.ajax_url,
|
1132 |
+
data: {
|
1133 |
+
parent_id: parentID,
|
1134 |
+
type: wcp_settings.post_type,
|
1135 |
+
action: "wcp_update_folder",
|
1136 |
+
nonce: nonce,
|
1137 |
+
term_id: fileFolderID,
|
1138 |
+
order: folderOrder,
|
1139 |
+
name: folderNameDynamic
|
1140 |
+
},
|
1141 |
+
method: 'post',
|
1142 |
+
success: function (res) {
|
1143 |
+
result = $.parseJSON(res);
|
1144 |
+
if (result.status == '1') {
|
1145 |
+
$("#js-tree-menu").jstree('rename_node', result.id , " "+result.term_title);
|
1146 |
+
folderPostId = getIndexForPostSetting(result.id);
|
1147 |
+
if(folderPostId != null) {
|
1148 |
+
folderPropertyArray[folderPostId]['nonce'] = result.nonce;
|
1149 |
+
folderPropertyArray[folderPostId]['slug'] = result.slug;
|
1150 |
+
}
|
1151 |
+
add_menu_to_list();
|
1152 |
+
$(".folder-popup-form").hide();
|
1153 |
+
$(".folder-popup-form").removeClass("disabled");
|
1154 |
+
ajaxAnimation();
|
1155 |
+
if($("#media-attachment-taxonomy-filter").length) {
|
1156 |
+
resetMediaData(0)
|
1157 |
+
}
|
1158 |
+
} else {
|
1159 |
+
$(".folder-popup-form").hide();
|
1160 |
+
$(".folder-popup-form").removeClass("disabled");
|
1161 |
+
$("#error-folder-popup-message").html(result.message);
|
1162 |
+
$("#error-folder-popup").show();
|
1163 |
+
}
|
1164 |
+
}
|
1165 |
+
});
|
1166 |
+
}
|
1167 |
+
return false;
|
1168 |
+
});
|
1169 |
+
});
|
1170 |
+
|
1171 |
+
function updateFolder() {
|
1172 |
+
folderName = $.trim($("#js-tree-menu").jstree(true).get_node(fileFolderID).text);
|
1173 |
+
parentID = $("#wcp_folder_"+fileFolderID).closest("li.jstree-node").data("folder-id");
|
1174 |
+
if(parentID == undefined) {
|
1175 |
+
parentID = 0;
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
$("#update-folder-data").text("Submit");
|
1179 |
+
$(".folder-form-errors").removeClass("active");
|
1180 |
+
$("#update-folder-item-name").val(folderName);
|
1181 |
+
$("#update-folder-item").removeClass("disabled");
|
1182 |
+
$("#update-folder-item").show();
|
1183 |
+
$("#update-folder-item-name").focus();
|
1184 |
+
$(".dynamic-menu").remove();
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
/* Remove Folders */
|
1188 |
+
$(document).ready(function(){
|
1189 |
+
$("#inline-remove").click(function(){
|
1190 |
+
if($("#js-tree-menu a.jstree-clicked").length) {
|
1191 |
+
fileFolderID = $("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id");
|
1192 |
+
removeFolderFromID(1);
|
1193 |
+
$(".dynamic-menu").remove();
|
1194 |
+
$(".active-menu").removeClass("active-menu");
|
1195 |
+
} else {
|
1196 |
+
if($("#folder-hide-show-checkbox").is(":checked")) {
|
1197 |
+
$(".dynamic-menu").remove();
|
1198 |
+
removeFolderFromID(1);
|
1199 |
+
}
|
1200 |
+
}
|
1201 |
+
});
|
1202 |
+
|
1203 |
+
$(document).on("click","#folder-hide-show-checkbox",function(){
|
1204 |
+
if($(this).is(":checked")) {
|
1205 |
+
$("#js-tree-menu").addClass("show-folder-checkbox");
|
1206 |
+
} else {
|
1207 |
+
$("#js-tree-menu input.checkbox").attr("checked", false);
|
1208 |
+
$("#js-tree-menu").removeClass("show-folder-checkbox");
|
1209 |
+
}
|
1210 |
+
});
|
1211 |
+
|
1212 |
+
$(document).on("click", ".folder-checkbox, .input-checkbox", function(e){
|
1213 |
+
e.stopImmediatePropagation();
|
1214 |
+
e.stopPropagation();
|
1215 |
+
});
|
1216 |
+
|
1217 |
+
$(".remove-folder").livequery(function(){
|
1218 |
+
$(this).click(function() {
|
1219 |
+
folderID = $(this).closest("li.jstree-node").data("id");
|
1220 |
+
if($(this).closest("li.jstree-node").length) {
|
1221 |
+
fileFolderID = $(this).closest("li.jstree-node").attr("id");
|
1222 |
+
} else {
|
1223 |
+
fileFolderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
1224 |
+
}
|
1225 |
+
removeFolderFromID(0);
|
1226 |
+
$(".dynamic-menu").remove();
|
1227 |
+
$(".active-menu").removeClass("active-menu");
|
1228 |
+
});
|
1229 |
+
});
|
1230 |
+
|
1231 |
+
$(document).on("click", "#remove-folder-item", function (e){
|
1232 |
+
e.stopPropagation();
|
1233 |
+
$(".folder-popup-form").addClass("disabled");
|
1234 |
+
$("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>');
|
1235 |
+
nonce = getSettingForPost(fileFolderID, 'nonce');
|
1236 |
+
if(isMultipleRemove) {
|
1237 |
+
removeMultipleFolderItems();
|
1238 |
+
} else {
|
1239 |
+
$.ajax({
|
1240 |
+
url: wcp_settings.ajax_url,
|
1241 |
+
data: "type=" + wcp_settings.post_type + "&action=wcp_remove_folder&term_id=" + fileFolderID + "&nonce=" + nonce,
|
1242 |
+
method: 'post',
|
1243 |
+
success: function (res) {
|
1244 |
+
res = $.parseJSON(res);
|
1245 |
+
if (res.status == '1') {
|
1246 |
+
$('#js-tree-menu').jstree().delete_node(fileFolderID);
|
1247 |
+
isKeyActive = parseInt(res.is_key_active);
|
1248 |
+
n_o_file = parseInt(res.folders);
|
1249 |
+
$("#current-folder").text(n_o_file);
|
1250 |
+
$("#ttl-fldr").text((3*3)+(4/(2*2)));
|
1251 |
+
$(".sticky-folders .sticky-folder-"+fileFolderID).remove();
|
1252 |
+
add_menu_to_list();
|
1253 |
+
ajaxAnimation();
|
1254 |
+
$(".folder-popup-form").hide();
|
1255 |
+
$(".folder-popup-form").removeClass("disabled");
|
1256 |
+
resetMediaAndPosts();
|
1257 |
+
make_sticky_folder_menu();
|
1258 |
+
if (activeRecordID == fileFolderID) {
|
1259 |
+
$(".header-posts").trigger("click");
|
1260 |
+
}
|
1261 |
+
} else {
|
1262 |
+
$(".folder-popup-form").hide();
|
1263 |
+
$(".folder-popup-form").removeClass("disabled");
|
1264 |
+
$("#error-folder-popup-message").html(res.message);
|
1265 |
+
$("#error-folder-popup").show();
|
1266 |
+
}
|
1267 |
+
}
|
1268 |
+
});
|
1269 |
+
}
|
1270 |
+
});
|
1271 |
+
});
|
1272 |
+
|
1273 |
+
function check_for_sub_menu() {
|
1274 |
+
$("#js-tree-menu li.jstree-node").removeClass("has-sub-tree");
|
1275 |
+
$("#js-tree-menu li.jstree-node").each(function(){
|
1276 |
+
if($(this).find("ul.ui-sortable li").length) {
|
1277 |
+
$(this).addClass("has-sub-tree");
|
1278 |
+
} else {
|
1279 |
+
$(this).removeClass("active");
|
1280 |
+
}
|
1281 |
+
});
|
1282 |
+
}
|
1283 |
+
|
1284 |
+
function removeMultipleFolderItems() {
|
1285 |
+
if($("#folder-hide-show-checkbox").is(":checked")) {
|
1286 |
+
if($("#js-tree-menu input.checkbox:checked").length > 0) {
|
1287 |
+
var folderIDs = "";
|
1288 |
+
var activeItemDeleted = false;
|
1289 |
+
$("#js-tree-menu input.checkbox:checked").each(function(){
|
1290 |
+
folderIDs += $(this).closest("li.jstree-node").attr("id")+",";
|
1291 |
+
if($(this).closest("li.jstree-node").hasClass("jstree-clicked")) {
|
1292 |
+
activeItemDeleted = true;
|
1293 |
+
}
|
1294 |
+
});
|
1295 |
+
$(".form-loader-count").css("width", "100%");
|
1296 |
+
$.ajax({
|
1297 |
+
url: wcp_settings.ajax_url,
|
1298 |
+
data: "type=" + wcp_settings.post_type + "&action=wcp_remove_muliple_folder&term_id=" + folderIDs+"&nonce="+wcp_settings.nonce,
|
1299 |
+
method: 'post',
|
1300 |
+
success: function (res) {
|
1301 |
+
res = $.parseJSON(res);
|
1302 |
+
$(".form-loader-count").css("width", "0px");
|
1303 |
+
if (res.status == '1') {
|
1304 |
+
isKeyActive = parseInt(res.is_key_active);
|
1305 |
+
n_o_file = parseInt(res.folders);
|
1306 |
+
$("#current-folder").text(n_o_file);
|
1307 |
+
for(i=0; i<res.term_ids.length; i++) {
|
1308 |
+
$('#js-tree-menu').jstree().delete_node(res.term_ids[i]);
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
$("#ttl-fldr").text((4*2)+(4/2));
|
1312 |
+
// add_menu_to_list();
|
1313 |
+
ajaxAnimation();
|
1314 |
+
$(".folder-popup-form").hide();
|
1315 |
+
$(".folder-popup-form").removeClass("disabled");
|
1316 |
+
resetMediaAndPosts();
|
1317 |
+
make_sticky_folder_menu();
|
1318 |
+
|
1319 |
+
ajaxAnimation();
|
1320 |
+
|
1321 |
+
check_for_sub_menu();
|
1322 |
+
|
1323 |
+
if(!$("#wcp_folder_"+activeRecordID).length) {
|
1324 |
+
$(".header-posts a").trigger("click");
|
1325 |
+
activeRecordID = 0;
|
1326 |
+
}
|
1327 |
+
} else {
|
1328 |
+
window.location.reload();
|
1329 |
+
}
|
1330 |
+
$("#folder-hide-show-checkbox").attr("checked", false);
|
1331 |
+
$("#js-tree-menu input.checkbox").attr("checked", false);
|
1332 |
+
$("#js-tree-menu").removeClass("show-folder-checkbox");
|
1333 |
+
}
|
1334 |
+
});
|
1335 |
+
} else {
|
1336 |
+
|
1337 |
+
}
|
1338 |
+
}
|
1339 |
+
}
|
1340 |
+
|
1341 |
+
function removeFolderFromID(popup_type) {
|
1342 |
+
var removeMessage = "Are you sure you want to delete the selected folder?";
|
1343 |
+
var removeNotice = "Items in the folder will not be deleted.";
|
1344 |
+
isMultipleRemove = false;
|
1345 |
+
if(popup_type == 1) {
|
1346 |
+
if($("#folder-hide-show-checkbox").is(":checked")) {
|
1347 |
+
isMultipleRemove = true;
|
1348 |
+
if($("#js-tree-menu input.checkbox:checked").length == 0) {
|
1349 |
+
$(".folder-popup-form").hide();
|
1350 |
+
$(".folder-popup-form").removeClass("disabled");
|
1351 |
+
$("#error-folder-popup-message").html("Please select at least one folder to delete");
|
1352 |
+
$("#error-folder-popup").show();
|
1353 |
+
return;
|
1354 |
+
} else {
|
1355 |
+
if($("#js-tree-menu input.checkbox:checked").length > 1) {
|
1356 |
+
removeMessage = "Are you sure you want to delete the selected folders?";
|
1357 |
+
removeNotice = "Items in the selected folders will not be deleted.";
|
1358 |
+
}
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
}
|
1362 |
+
$(".folder-popup-form").hide();
|
1363 |
+
$(".folder-popup-form").removeClass("disabled");
|
1364 |
+
$("#remove-folder-item").text("Yes, Delete it!");
|
1365 |
+
$("#remove-folder-message").text(removeMessage);
|
1366 |
+
$("#remove-folder-notice").text(removeNotice);
|
1367 |
+
$("#confirm-remove-folder").show();
|
1368 |
+
$("#remove-folder-item").focus();
|
1369 |
+
}
|
1370 |
+
|
1371 |
+
$(document).ready(function(){
|
1372 |
+
$(".mark-folder").livequery(function(){
|
1373 |
+
$(this).click(function(e){
|
1374 |
+
e.stopPropagation();
|
1375 |
+
if($(this).closest("li.jstree-node").length) {
|
1376 |
+
folderID = $(this).closest("li.jstree-node").attr("id");
|
1377 |
+
} else {
|
1378 |
+
folderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
1379 |
+
}
|
1380 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
1381 |
+
$(".form-loader-count").css("width","100%");
|
1382 |
+
$(".dynamic-menu").remove();
|
1383 |
+
$(".active-menu").removeClass("active-menu");
|
1384 |
+
$.ajax({
|
1385 |
+
url: wcp_settings.ajax_url,
|
1386 |
+
data: "term_id=" + folderID + "&type=" + wcp_settings.post_type + "&action=wcp_mark_un_mark_folder&nonce="+nonce,
|
1387 |
+
method: 'post',
|
1388 |
+
cache: false,
|
1389 |
+
success: function (res) {
|
1390 |
+
res = $.parseJSON(res);
|
1391 |
+
$(".form-loader-count").css("width","0%");
|
1392 |
+
if (res.status == '1') {
|
1393 |
+
folderPostId = getIndexForPostSetting(res.id);
|
1394 |
+
if(res.marked == '1') {
|
1395 |
+
$("li.jstree-node[id='"+res.id+"']").addClass("is-high");
|
1396 |
+
$(".sticky-folder-"+res.id).addClass("is-high");
|
1397 |
+
if(folderPostId != null) {
|
1398 |
+
folderPropertyArray[folderPostId]['is_high'] = 1;
|
1399 |
+
}
|
1400 |
+
} else {
|
1401 |
+
$("li.jstree-node[id='"+res.id+"']").removeClass("is-high");
|
1402 |
+
$(".sticky-folder-"+res.id).removeClass("is-high");
|
1403 |
+
if(folderPostId != null) {
|
1404 |
+
folderPropertyArray[folderPostId]['is_high'] = 0;
|
1405 |
+
}
|
1406 |
+
}
|
1407 |
+
add_menu_to_list();
|
1408 |
+
ajaxAnimation();
|
1409 |
+
} else {
|
1410 |
+
$(".folder-popup-form").hide();
|
1411 |
+
$(".folder-popup-form").removeClass("disabled");
|
1412 |
+
$("#error-folder-popup-message").html(res.message);
|
1413 |
+
$("#error-folder-popup").show();
|
1414 |
+
}
|
1415 |
+
}
|
1416 |
+
});
|
1417 |
+
});
|
1418 |
+
});
|
1419 |
+
});
|
1420 |
+
|
1421 |
+
/* change folder status */
|
1422 |
+
$(document).ready(function(){
|
1423 |
+
$(".jstree-node .jstree-icon").livequery(function(){
|
1424 |
+
$(this).click(function(){
|
1425 |
+
folderID = $(this).closest("li.jstree-node").attr("id");
|
1426 |
+
if($("li.jstree-node[id='"+folderID+"']").hasClass("jstree-open")) {
|
1427 |
+
folderStatus = 0;
|
1428 |
+
} else {
|
1429 |
+
folderStatus = 1;
|
1430 |
+
}
|
1431 |
+
$(".form-loader-count").css("width","100%");
|
1432 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
1433 |
+
checkForExpandCollapse();
|
1434 |
+
jQuery.ajax({
|
1435 |
+
url: wcp_settings.ajax_url,
|
1436 |
+
data: "is_active=" + folderStatus + "&action=save_wcp_folder_state&term_id=" + folderID+"&nonce="+nonce,
|
1437 |
+
method: 'post',
|
1438 |
+
success: function (res) {
|
1439 |
+
$(".form-loader-count").css("width","0");
|
1440 |
+
res = jQuery.parseJSON(res);
|
1441 |
+
if(res.status == "0") {
|
1442 |
+
// $(".folder-popup-form").hide();
|
1443 |
+
// $(".folder-popup-form").removeClass("disabled");
|
1444 |
+
// $("#error-folder-popup-message").html(res.message);
|
1445 |
+
// $("#error-folder-popup").show();
|
1446 |
+
} else {
|
1447 |
+
if($("#wcp_folder_"+folderID).hasClass("active")) {
|
1448 |
+
$("#wcp_folder_"+folderID).removeClass("active");
|
1449 |
+
$("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideUp();
|
1450 |
+
folderStatus = 0;
|
1451 |
+
} else {
|
1452 |
+
$("#wcp_folder_"+folderID).addClass("active");
|
1453 |
+
$("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideDown();
|
1454 |
+
folderStatus = 1;
|
1455 |
+
}
|
1456 |
+
ajaxAnimation();
|
1457 |
+
}
|
1458 |
+
}
|
1459 |
+
});
|
1460 |
+
});
|
1461 |
+
});
|
1462 |
+
});
|
1463 |
+
|
1464 |
+
/* refresh listing on click */
|
1465 |
+
$(document).ready(function(){
|
1466 |
+
$(document).on("click", "a.jstree-anchor", function(e) {
|
1467 |
+
e.stopPropagation();
|
1468 |
+
$(".un-categorised-items").removeClass("active-item");
|
1469 |
+
$(".header-posts a").removeClass("active-item");
|
1470 |
+
$("active-item").removeClass("active-item");
|
1471 |
+
activeRecordID = $(this).closest("li.jstree-node").attr("id");
|
1472 |
+
fileFolderID = $(this).closest("li.jstree-node").attr("id");
|
1473 |
+
$(".sticky-folders .sticky-folder-"+activeRecordID+" a").addClass("active-item");
|
1474 |
+
if(!$("#media-attachment-taxonomy-filter").length) {
|
1475 |
+
var folderSlug = getSettingForPost(activeRecordID, 'slug');
|
1476 |
+
folderCurrentURL = wcp_settings.page_url + folderSlug;
|
1477 |
+
$(".form-loader-count").css("width", "100%");
|
1478 |
+
if($("#folder-posts-filter").length) {
|
1479 |
+
$("#folder-posts-filter").load(folderCurrentURL + " #posts-filter", function(){
|
1480 |
+
var obj = { Title: folderSlug, Url: folderCurrentURL };
|
1481 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1482 |
+
set_default_folders(folderSlug);
|
1483 |
+
if (wcp_settings.show_in_page == "show" && !$(".tree-structure").length) {
|
1484 |
+
$(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>');
|
1485 |
+
}
|
1486 |
+
triggerInlineUpdate();
|
1487 |
+
});
|
1488 |
+
} else {
|
1489 |
+
$("#wpbody").load(folderCurrentURL + " #wpbody-content", function(){
|
1490 |
+
var obj = { Title: folderSlug, Url: folderCurrentURL };
|
1491 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1492 |
+
set_default_folders(folderSlug);
|
1493 |
+
if (wcp_settings.show_in_page == "show" && !$(".tree-structure").length) {
|
1494 |
+
$(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>');
|
1495 |
+
}
|
1496 |
+
triggerInlineUpdate();
|
1497 |
+
});
|
1498 |
+
}
|
1499 |
+
} else {
|
1500 |
+
var thisIndex = $(this).closest("li.jstree-node").attr("id");
|
1501 |
+
$("#media-attachment-taxonomy-filter").val(thisIndex);
|
1502 |
+
$("#media-attachment-taxonomy-filter").trigger("change");
|
1503 |
+
thisSlug = getSettingForPost(thisIndex, 'slug');
|
1504 |
+
folderCurrentURL = wcp_settings.page_url + thisSlug;
|
1505 |
+
var obj = { Title: thisSlug, Url: folderCurrentURL };
|
1506 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1507 |
+
set_default_folders(thisSlug);
|
1508 |
+
$(".custom-media-select").removeClass("active");
|
1509 |
+
}
|
1510 |
+
add_active_item_to_list();
|
1511 |
+
$(".sticky-folders .sticky-folder-"+activeRecordID+" a").addClass("active-item");
|
1512 |
+
});
|
1513 |
+
|
1514 |
+
$(".header-posts").click(function(){
|
1515 |
+
activeRecordID = "";
|
1516 |
+
$(".wcp-container .route").removeClass("active-item");
|
1517 |
+
$(".un-categorised-items").removeClass("active-item");
|
1518 |
+
$(".sticky-folders .active-item").removeClass("active-item");
|
1519 |
+
$(".header-posts a").addClass("active-item");
|
1520 |
+
$(".jstree-clicked").removeClass("jstree-clicked");
|
1521 |
+
if(!$("#media-attachment-taxonomy-filter").length) {
|
1522 |
+
folderCurrentURL = wcp_settings.page_url;
|
1523 |
+
$(".form-loader-count").css("width", "100%");
|
1524 |
+
if($("#folder-posts-filter").length) {
|
1525 |
+
$("#folder-posts-filter").load(folderCurrentURL + " #posts-filter", function(){
|
1526 |
+
var obj = { Title: "", Url: folderCurrentURL };
|
1527 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1528 |
+
set_default_folders("all");
|
1529 |
+
if (wcp_settings.show_in_page == "show" && !$(".tree-structure").length) {
|
1530 |
+
$(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>');
|
1531 |
+
}
|
1532 |
+
add_active_item_to_list();
|
1533 |
+
triggerInlineUpdate();
|
1534 |
+
});
|
1535 |
+
} else {
|
1536 |
+
$("#wpbody").load(folderCurrentURL + " #wpbody-content", function(){
|
1537 |
+
var obj = { Title: "", Url: folderCurrentURL };
|
1538 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1539 |
+
set_default_folders("all");
|
1540 |
+
if (wcp_settings.show_in_page == "show" && !$(".tree-structure").length) {
|
1541 |
+
$(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>');
|
1542 |
+
}
|
1543 |
+
add_active_item_to_list();
|
1544 |
+
triggerInlineUpdate();
|
1545 |
+
});
|
1546 |
+
}
|
1547 |
+
} else {
|
1548 |
+
activeRecordID = "";
|
1549 |
+
$("#media-attachment-taxonomy-filter").val("all");
|
1550 |
+
$("#media-attachment-taxonomy-filter").trigger("change");
|
1551 |
+
var obj = { Title: "", Url: wcp_settings.page_url };
|
1552 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1553 |
+
set_default_folders("all");
|
1554 |
+
add_active_item_to_list();
|
1555 |
+
}
|
1556 |
+
});
|
1557 |
+
|
1558 |
+
$(".un-categorised-items").click(function(){
|
1559 |
+
activeRecordID = "-1";
|
1560 |
+
$(".wcp-container .route").removeClass("active-item");
|
1561 |
+
$(".header-posts a").removeClass("active-item");
|
1562 |
+
$(".un-categorised-items").addClass("active-item");
|
1563 |
+
$(".sticky-folders .active-item").removeClass("active-item");
|
1564 |
+
$(".jstree-clicked").removeClass("jstree-clicked");
|
1565 |
+
if(!$("#media-attachment-taxonomy-filter").length) {
|
1566 |
+
folderCurrentURL = wcp_settings.page_url+"-1";
|
1567 |
+
$(".form-loader-count").css("width", "100%");
|
1568 |
+
if($("#folder-posts-filter").length) {
|
1569 |
+
$("#folder-posts-filter").load(folderCurrentURL + " #posts-filter", function(){
|
1570 |
+
var obj = { Title: "", Url: folderCurrentURL };
|
1571 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1572 |
+
set_default_folders("-1");
|
1573 |
+
if (wcp_settings.show_in_page == "show" && !$(".tree-structure").length) {
|
1574 |
+
$(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>');
|
1575 |
+
}
|
1576 |
+
add_active_item_to_list();
|
1577 |
+
triggerInlineUpdate();
|
1578 |
+
});
|
1579 |
+
} else {
|
1580 |
+
$("#wpbody").load(folderCurrentURL + " #wpbody-content", function(){
|
1581 |
+
var obj = { Title: "", Url: folderCurrentURL };
|
1582 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1583 |
+
set_default_folders("-1");
|
1584 |
+
if (wcp_settings.show_in_page == "show" && !$(".tree-structure").length) {
|
1585 |
+
$(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>');
|
1586 |
+
}
|
1587 |
+
add_active_item_to_list();
|
1588 |
+
triggerInlineUpdate();
|
1589 |
+
});
|
1590 |
+
}
|
1591 |
+
} else {
|
1592 |
+
$("#media-attachment-taxonomy-filter").val("unassigned");
|
1593 |
+
$("#media-attachment-taxonomy-filter").trigger("change");
|
1594 |
+
var obj = { Title: "", Url: wcp_settings.page_url+"-1" };
|
1595 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1596 |
+
set_default_folders("-1");
|
1597 |
+
add_active_item_to_list();
|
1598 |
+
}
|
1599 |
+
});
|
1600 |
+
|
1601 |
+
/* Expand/Collapse */
|
1602 |
+
$("#expand-collapse-list").click(function(e){
|
1603 |
+
e.stopPropagation();
|
1604 |
+
statusType = 0;
|
1605 |
+
if($(this).hasClass("all-open")) {
|
1606 |
+
$(this).removeClass("all-open");
|
1607 |
+
statusType = 0;
|
1608 |
+
$(this).attr("data-folder-tooltip","Expand");
|
1609 |
+
$("#js-tree-menu").jstree("close_all");
|
1610 |
+
} else {
|
1611 |
+
$(this).addClass("all-open");
|
1612 |
+
statusType = 1;
|
1613 |
+
$(this).attr("data-folder-tooltip","Collapse");
|
1614 |
+
$("#js-tree-menu").jstree("open_all");
|
1615 |
+
}
|
1616 |
+
folderIDs = "";
|
1617 |
+
$("#js-tree-menu .jstree-node:not(.jstree-leaf)").each(function(){
|
1618 |
+
folderIDs += $(this).attr("id")+",";
|
1619 |
+
});
|
1620 |
+
if(folderIDs != "") {
|
1621 |
+
$(".form-loader-count").css("width","100%");
|
1622 |
+
nonce = wcp_settings.nonce;
|
1623 |
+
jQuery.ajax({
|
1624 |
+
url: wcp_settings.ajax_url,
|
1625 |
+
data: "type=" + wcp_settings.post_type + "&action=wcp_change_all_status&status=" + statusType + "&folders="+folderIDs+"&nonce="+nonce,
|
1626 |
+
method: 'post',
|
1627 |
+
success: function (res) {
|
1628 |
+
$(".form-loader-count").css("width","0");
|
1629 |
+
res = jQuery.parseJSON(res);
|
1630 |
+
if(res.status == "0") {
|
1631 |
+
$(".folder-popup-form").hide();
|
1632 |
+
$(".folder-popup-form").removeClass("disabled");
|
1633 |
+
$("#error-folder-popup-message").html(res.message);
|
1634 |
+
$("#error-folder-popup").show();
|
1635 |
+
window.location.reload(true);
|
1636 |
+
}
|
1637 |
+
}
|
1638 |
+
});
|
1639 |
+
}
|
1640 |
+
});
|
1641 |
+
|
1642 |
+
checkForExpandCollapse();
|
1643 |
+
});
|
1644 |
+
|
1645 |
+
function initJSTree() {
|
1646 |
+
$(treeId).jstree({
|
1647 |
+
"core": {
|
1648 |
+
'cache':false,
|
1649 |
+
"animation": 0,
|
1650 |
+
// "check_callback": true,
|
1651 |
+
check_callback: function(e, t, n, r, o) {
|
1652 |
+
$("*").removeClass("drag-bot").removeClass("drag-in").removeClass("drag-up");
|
1653 |
+
if (("move_node" === e || "copy_node" === e) && o && o.dnd)
|
1654 |
+
switch (o.pos) {
|
1655 |
+
case "a":
|
1656 |
+
o.origin.get_node(o.ref, !0).addClass("drag-bot");
|
1657 |
+
nodeId = $(".drag-bot").attr("id");
|
1658 |
+
$("#jstree-dnd").text("Below "+$.trim($("#js-tree-menu").jstree(true).get_node(nodeId).text));
|
1659 |
+
break;
|
1660 |
+
case "i":
|
1661 |
+
o.origin.get_node(o.ref, !0).addClass("drag-in");
|
1662 |
+
nodeId = $(".drag-in").attr("id");
|
1663 |
+
$("#jstree-dnd").text("Inside "+$.trim($("#js-tree-menu").jstree(true).get_node(nodeId).text));
|
1664 |
+
break;
|
1665 |
+
case "b":
|
1666 |
+
o.origin.get_node(o.ref, !0).addClass("drag-up");
|
1667 |
+
nodeId = $(".drag-up").attr("id");
|
1668 |
+
$("#jstree-dnd").text("Above "+$.trim($("#js-tree-menu").jstree(true).get_node(nodeId).text));
|
1669 |
+
break;
|
1670 |
+
default:
|
1671 |
+
$("#jstree-dnd").text($("#jstree-dnd").data("txt"));
|
1672 |
+
break;
|
1673 |
+
}
|
1674 |
+
return !0
|
1675 |
+
}
|
1676 |
+
},
|
1677 |
+
data: {
|
1678 |
+
cache : false
|
1679 |
+
},
|
1680 |
+
select_node: false,
|
1681 |
+
search: {
|
1682 |
+
show_only_matches: true,
|
1683 |
+
case_sensitive: false,
|
1684 |
+
fuzzy: false
|
1685 |
+
},
|
1686 |
+
plugins: ["dnd", "search", "contextmenu"],
|
1687 |
+
contextmenu: {
|
1688 |
+
select_node: 0,
|
1689 |
+
show_at_node: 0,
|
1690 |
+
items: function() {
|
1691 |
+
return {};
|
1692 |
+
}
|
1693 |
+
}
|
1694 |
+
}).bind("ready.jstree", (function() {
|
1695 |
+
setFolderCount();
|
1696 |
+
})).bind("move_node.jstree", (function(t, n) {
|
1697 |
+
folderMoveId = n.node.id;
|
1698 |
+
orderString = "";
|
1699 |
+
$(".jstree-node[id='"+folderMoveId+"']").closest("ul").children().each(function(){
|
1700 |
+
if($(this).attr("id") != 'undefined') {
|
1701 |
+
orderString += $(this).attr("id") + ",";
|
1702 |
+
}
|
1703 |
+
});
|
1704 |
+
if($("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")) {
|
1705 |
+
parentID = $("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().attr("id");
|
1706 |
+
} else {
|
1707 |
+
parentID = 0;
|
1708 |
+
}
|
1709 |
+
if(orderString != "") {
|
1710 |
+
$(".form-loader-count").css("width","100%");
|
1711 |
+
jQuery.ajax({
|
1712 |
+
url: wcp_settings.ajax_url,
|
1713 |
+
data: "term_ids=" + orderString + "&action=wcp_save_folder_order&type=" + wcp_settings.post_type+"&nonce="+wcp_settings.nonce+"&term_id="+folderMoveId+"&parent_id="+parentID,
|
1714 |
+
method: 'post',
|
1715 |
+
success: function (res) {
|
1716 |
+
res = jQuery.parseJSON(res);
|
1717 |
+
if (res.status == '1') {
|
1718 |
+
$("#wcp_folder_parent").html(res.options);
|
1719 |
+
$(".form-loader-count").css("width", "0");
|
1720 |
+
add_menu_to_list();
|
1721 |
+
resetMediaAndPosts();
|
1722 |
+
ajaxAnimation();
|
1723 |
+
} else {
|
1724 |
+
$(".folder-popup-form").hide();
|
1725 |
+
$(".folder-popup-form").removeClass("disabled");
|
1726 |
+
$("#error-folder-popup-message").html(res.message);
|
1727 |
+
$("#error-folder-popup").show();
|
1728 |
+
window.location.reload(true);
|
1729 |
+
}
|
1730 |
+
}
|
1731 |
+
});
|
1732 |
+
}
|
1733 |
+
}));
|
1734 |
+
}
|
1735 |
+
|
1736 |
+
/* sorting folders */
|
1737 |
+
$(document).ready(function(){
|
1738 |
+
$(document).on("click", "body, html", function(){
|
1739 |
+
$(".folder-order").removeClass("active");
|
1740 |
+
});
|
1741 |
+
|
1742 |
+
$(document).on("click", "#sort-order-list", function(e){
|
1743 |
+
e.stopPropagation();
|
1744 |
+
$(".folder-order").toggleClass("active");
|
1745 |
+
});
|
1746 |
+
|
1747 |
+
$(document).on("click", ".folder-sort-menu a", function(e) {
|
1748 |
+
e.stopPropagation();
|
1749 |
+
e.preventDefault();
|
1750 |
+
$(".form-loader-count").css("width", "100%");
|
1751 |
+
$(".folder-order").removeClass("active");
|
1752 |
+
lastOrderStatus = $(this).attr("data-sort");
|
1753 |
+
jQuery.ajax({
|
1754 |
+
url: wcp_settings.ajax_url,
|
1755 |
+
data: "type=" + wcp_settings.post_type + "&action=wcp_folders_by_order&nonce=" + wcp_settings.nonce+"&order="+$(this).attr("data-sort"),
|
1756 |
+
method: 'post',
|
1757 |
+
success: function (res) {
|
1758 |
+
res = jQuery.parseJSON(res);
|
1759 |
+
if(res.status == 1) {
|
1760 |
+
$("#js-tree-menu").jstree().destroy();
|
1761 |
+
$("#js-tree-menu").append("<ul></ul>");
|
1762 |
+
$("#js-tree-menu ul").html(res.data);
|
1763 |
+
initJSTree();
|
1764 |
+
}
|
1765 |
+
$(".form-loader-count").css("width", "0");
|
1766 |
+
add_active_item_to_list();
|
1767 |
+
}
|
1768 |
+
});
|
1769 |
+
});
|
1770 |
+
});
|
1771 |
+
|
1772 |
+
/* Search functionality */
|
1773 |
+
$(document).ready(function(){
|
1774 |
+
$(document).on("keyup", "#folder-search", function(){
|
1775 |
+
checkForFolderSearch();
|
1776 |
+
});
|
1777 |
+
|
1778 |
+
$(document).on("change", "#folder-search", function(){
|
1779 |
+
checkForFolderSearch();
|
1780 |
+
});
|
1781 |
+
|
1782 |
+
$(document).on("blur", "#folder-search", function(){
|
1783 |
+
checkForFolderSearch();
|
1784 |
+
});
|
1785 |
+
});
|
1786 |
+
|
1787 |
+
function checkForFolderSearch() {
|
1788 |
+
var searchVal = $.trim($("#folder-search").val());
|
1789 |
+
$('#js-tree-menu').jstree('search', searchVal);
|
1790 |
+
}
|
1791 |
+
|
1792 |
+
/* checkbox library */
|
1793 |
+
$(document).ready(function(){
|
1794 |
+
$(".wcp-move-file").livequery(function(){
|
1795 |
+
$(this).draggable({
|
1796 |
+
revert: "invalid",
|
1797 |
+
containment: "document",
|
1798 |
+
helper: "clone",
|
1799 |
+
cursor: "move",
|
1800 |
+
start: function( event, ui){
|
1801 |
+
$(this).closest("td").addClass("wcp-draggable");
|
1802 |
+
$("body").addClass("no-hover-css");
|
1803 |
+
},
|
1804 |
+
stop: function( event, ui ) {
|
1805 |
+
$(this).closest("td").removeClass("wcp-draggable");
|
1806 |
+
$("body").removeClass("no-hover-css");
|
1807 |
+
}
|
1808 |
+
});
|
1809 |
+
});
|
1810 |
+
|
1811 |
+
$(".wcp-move-multiple").livequery(function(){
|
1812 |
+
$(this).draggable({
|
1813 |
+
// /*cancel: "a.ui-icon",*/
|
1814 |
+
// revert: "invalid",
|
1815 |
+
// containment: "document",
|
1816 |
+
// helper: "clone",
|
1817 |
+
// cursor: "move",
|
1818 |
+
// start: function( event, ui){
|
1819 |
+
// $("body").addClass("no-hover-css");
|
1820 |
+
// },
|
1821 |
+
// stop: function( event, ui ) {
|
1822 |
+
// $("body").removeClass("no-hover-css");
|
1823 |
+
// }
|
1824 |
+
revert: "invalid",
|
1825 |
+
containment: "document",
|
1826 |
+
helper: function (event, ui) {
|
1827 |
+
$(".selected-items").remove();
|
1828 |
+
selectedItems = $("#the-list th input:checked").length;
|
1829 |
+
if(selectedItems > 0) {
|
1830 |
+
selectedItems = (selectedItems == 0 || selectedItems == 1) ? "1 Item" : selectedItems + " Items";
|
1831 |
+
return $("<div class='selected-items'><span class='total-post-count'>" + selectedItems + " Selected</span></div>");
|
1832 |
+
} else {
|
1833 |
+
return $("<div class='selected-items'><span class='total-post-count'>Select Items to move</span></div>");
|
1834 |
+
}
|
1835 |
+
},
|
1836 |
+
start: function( event, ui){
|
1837 |
+
$("body").addClass("no-hover-css");
|
1838 |
+
},
|
1839 |
+
cursor: "move",
|
1840 |
+
cursorAt: {
|
1841 |
+
left: 0,
|
1842 |
+
top: 0
|
1843 |
+
},
|
1844 |
+
stop: function( event, ui ) {
|
1845 |
+
$(".selected-items").remove();
|
1846 |
+
$("body").removeClass("no-hover-css");
|
1847 |
+
}
|
1848 |
+
});
|
1849 |
+
});
|
1850 |
+
});
|
1851 |
+
|
1852 |
+
function set_default_folders(post_id) {
|
1853 |
+
jQuery.ajax({
|
1854 |
+
url: wcp_settings.ajax_url,
|
1855 |
+
type: 'post',
|
1856 |
+
data: 'action=save_folder_last_status&post_type='+wcp_settings.post_type+"&post_id="+post_id+"&nonce="+wcp_settings.nonce,
|
1857 |
+
cache: false,
|
1858 |
+
async: false,
|
1859 |
+
success: function(){
|
1860 |
+
|
1861 |
+
}
|
1862 |
+
})
|
1863 |
+
}
|
1864 |
+
|
1865 |
+
/* Extra functions */
|
1866 |
+
function checkForExpandCollapse() {
|
1867 |
+
setTimeout(function(){
|
1868 |
+
currentStatus = true;
|
1869 |
+
if($("#js-tree-menu .jstree-node.jstree-leaf").length == $("#js-tree-menu .jstree-node").length) {
|
1870 |
+
$("#expand-collapse-list").removeClass("all-open");
|
1871 |
+
$("#expand-collapse-list").attr("data-folder-tooltip","Expand");
|
1872 |
+
} else {
|
1873 |
+
var totalChild = $("#js-tree-menu .jstree-node.jstree-closed").length + $("#js-tree-menu .jstree-node.jstree-open").length;
|
1874 |
+
if($("#js-tree-menu .jstree-node.jstree-closed").length == totalChild) {
|
1875 |
+
$("#expand-collapse-list").removeClass("all-open");
|
1876 |
+
$("#expand-collapse-list").attr("data-folder-tooltip","Expand");
|
1877 |
+
} else {
|
1878 |
+
$("#expand-collapse-list").addClass("all-open");
|
1879 |
+
$("#expand-collapse-list").attr("data-folder-tooltip","Collapse");
|
1880 |
+
}
|
1881 |
+
}
|
1882 |
+
}, 500);
|
1883 |
+
}
|
1884 |
+
|
1885 |
+
function apply_animation_height() {
|
1886 |
+
if($(".tree-structure-content .tree-structure li").length == 0) {
|
1887 |
+
$(".tree-structure-content").hide();
|
1888 |
+
} else {
|
1889 |
+
$(".tree-structure-content").show();
|
1890 |
+
oldHeight = $(".tree-structure-content .tree-structure").height();
|
1891 |
+
$(".tree-structure-content .tree-structure").height("auto");
|
1892 |
+
if($(".tree-structure-content .tree-structure").height() > 56) {
|
1893 |
+
$(".folders-toggle-button").show();
|
1894 |
+
} else {
|
1895 |
+
$(".folders-toggle-button").hide();
|
1896 |
+
}
|
1897 |
+
newHeight = $(".tree-structure-content .tree-structure").height();
|
1898 |
+
$(".tree-structure-content .tree-structure").attr("data-height", newHeight);
|
1899 |
+
|
1900 |
+
if($(".tree-structure-content").hasClass("active")) {
|
1901 |
+
$(".tree-structure-content .tree-structure").height(newHeight);
|
1902 |
+
$(".tree-structure-content .tree-structure").attr("data-height", newHeight);
|
1903 |
+
} else {
|
1904 |
+
$(".tree-structure-content .tree-structure").height(oldHeight);
|
1905 |
+
}
|
1906 |
+
}
|
1907 |
+
}
|
1908 |
+
|
1909 |
+
function ajaxAnimation() {
|
1910 |
+
$(".folder-loader-ajax").addClass("active");
|
1911 |
+
$(".folder-loader-ajax img").removeClass("active");
|
1912 |
+
$(".folder-loader-ajax svg#successAnimation").addClass("active").addClass("animated");
|
1913 |
+
setTimeout(function(){
|
1914 |
+
$(".folder-loader-ajax").removeClass("active");
|
1915 |
+
$(".folder-loader-ajax img").addClass("active");
|
1916 |
+
$(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated");
|
1917 |
+
}, 2000);
|
1918 |
+
}
|
1919 |
+
|
1920 |
+
function make_sticky_folder_menu() {
|
1921 |
+
$(".sticky-folders > ul").html("");
|
1922 |
+
var stickyMenuHtml = "";
|
1923 |
+
|
1924 |
+
$("#js-tree-menu li.jstree-node.is-sticky").each(function(){
|
1925 |
+
var folder_ID = $(this).attr("id");
|
1926 |
+
var folderName = $.trim($("#js-tree-menu").jstree(true).get_node(folder_ID).text);
|
1927 |
+
var folderCount = $("li.jstree-node[id='"+folder_ID+"'] > a span.premio-folder-count").text();
|
1928 |
+
var hasStar = $("li.jstree-node[id='"+folder_ID+"']").hasClass("is-high")?" is-high ":"";
|
1929 |
+
stickyMenuHtml += "<li data-folder-id='"+folder_ID+"' class='sticky-fldr "+hasStar+" sticky-folder-"+folder_ID+"'>" +
|
1930 |
+
"<a href='javascript:;'>" +
|
1931 |
+
"<span class='folder-title'>"+folderName+"</span>" +
|
1932 |
+
"<span class='folder-actions'>" +
|
1933 |
+
"<span class='update-inline-record'><i class='pfolder-edit-folder'></i></span>" +
|
1934 |
+
"<span class='star-icon'><i class='pfolder-star'></i></span>" +
|
1935 |
+
"<span class='premio-folder-count'>"+folderCount+"</span>" +
|
1936 |
+
"</span>"+
|
1937 |
+
"</a>" +
|
1938 |
+
"</li>";
|
1939 |
+
});
|
1940 |
+
$(".sticky-folders > ul").html(stickyMenuHtml);
|
1941 |
+
if($(".jstree-anchor.jstree-clicked").length) {
|
1942 |
+
var activeTermId = $(".jstree-anchor.jstree-clicked").closest("li.jstree-node").attr("id");
|
1943 |
+
$(".sticky-folders .sticky-folder-"+activeTermId+" a").addClass("active-item");
|
1944 |
+
}
|
1945 |
+
|
1946 |
+
if($(".sticky-folders > ul > li").length > 0) {
|
1947 |
+
$(".sticky-folders").addClass("active");
|
1948 |
+
} else {
|
1949 |
+
$(".sticky-folders").removeClass("active");
|
1950 |
+
}
|
1951 |
+
|
1952 |
+
setCustomScrollForFolder();
|
1953 |
+
}
|
1954 |
+
|
1955 |
+
if(wcp_settings.post_type == "attachment") {
|
1956 |
+
|
1957 |
+
$(document).ready(function(){
|
1958 |
+
if(wcp_settings.show_in_page == "show") {
|
1959 |
+
$(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div><div class="folders-toggle-button"><span></span></div></div>');
|
1960 |
+
}
|
1961 |
+
|
1962 |
+
add_menu_to_list();
|
1963 |
+
|
1964 |
+
apply_animation_height();
|
1965 |
+
});
|
1966 |
+
|
1967 |
+
$(window).on('load', function(){
|
1968 |
+
$("button.button.media-button.select-mode-toggle-button").after("<button class='button organize-button'>Bulk Organize</button>");
|
1969 |
+
$(".media-toolbar-secondary").append("<span class='media-info-message'>Drag and drop your media files to the relevant folders</span>");
|
1970 |
+
$(".delete-selected-button").before("<button type='button' class='button button-primary select-all-item-btn'>Select All</button>");
|
1971 |
+
$(".media-toolbar-secondary").after("<div class='custom-media-select'>Move Selected files to: <select class='media-select-folder'></select></div>");
|
1972 |
+
$(".media-toolbar").append("<div style='clear:both;'></div><div class='media-folder-loader'><span>Uploading files</span> <span id='current_upload_files'></span>/<span id='total_upload_files'></span><div class='folder-progress'><div class='folder-meter orange-bg'><span></span></div></div></div>");
|
1973 |
+
if($(".wcp-custom-form").length) {
|
1974 |
+
if (wp.Uploader !== undefined) {
|
1975 |
+
wp.Uploader.queue.on('reset', function () {
|
1976 |
+
resetMediaData(1);
|
1977 |
+
});
|
1978 |
+
}
|
1979 |
+
$(document).ajaxComplete(function(ev, jqXHR, settings) {
|
1980 |
+
actionName = settings.data;
|
1981 |
+
if (typeof actionName != "undefined") {
|
1982 |
+
if (actionName.length && actionName.indexOf("action=delete-post&id=") == 0) {
|
1983 |
+
resetMediaData(0);
|
1984 |
+
}
|
1985 |
+
}
|
1986 |
+
});
|
1987 |
+
}
|
1988 |
+
setTimeout(function(){
|
1989 |
+
docReferrar = document.referrer;
|
1990 |
+
if(docReferrar.indexOf("wp-admin/upload.php") != -1) {
|
1991 |
+
mediaMode = getCookie("media-select-mode");
|
1992 |
+
if (mediaMode == "on") {
|
1993 |
+
$("button.button.media-button.select-mode-toggle-button").trigger("click");
|
1994 |
+
//$(".attachments-browser li.attachment").draggable("enable");
|
1995 |
+
|
1996 |
+
if ($(".media-frame").hasClass("mode-select")) {
|
1997 |
+
$(".media-info-message").addClass("active");
|
1998 |
+
} else {
|
1999 |
+
$(".media-info-message, .custom-media-select").removeClass("active");
|
2000 |
+
}
|
2001 |
+
}
|
2002 |
+
} else {
|
2003 |
+
eraseCookie("media-select-mode");
|
2004 |
+
}
|
2005 |
+
resetMediaData(1);
|
2006 |
+
}, 1000);
|
2007 |
+
|
2008 |
+
$(document).on("click", ".attachments-browser ul.attachments .thumbnail", function(){
|
2009 |
+
if($(".media-toolbar").hasClass("media-toolbar-mode-select")) {
|
2010 |
+
if($("ul.attachments li.selected").length == 0) {
|
2011 |
+
$(".custom-media-select").removeClass("active");
|
2012 |
+
} else {
|
2013 |
+
$(".custom-media-select").addClass("active");
|
2014 |
+
}
|
2015 |
+
}
|
2016 |
+
});
|
2017 |
+
|
2018 |
+
$(document).on("change", ".media-select-folder", function(){
|
2019 |
+
if($(this).val() != "") {
|
2020 |
+
var checkStr = "";
|
2021 |
+
$(".attachments-browser li.attachment.selected").each(function(){
|
2022 |
+
checkStr += $(this).attr("data-id")+",";
|
2023 |
+
});
|
2024 |
+
if($(this).val() == "-1") {
|
2025 |
+
jQuery.ajax({
|
2026 |
+
url: wcp_settings.ajax_url,
|
2027 |
+
data: "post_id=" + checkStr + "&type=" + wcp_settings.post_type + "&action=wcp_remove_post_folder&folder_id=" + $(this).val() + "&nonce=" + wcp_settings.nonce +"&status="+wcp_settings.taxonomy_status+"&taxonomy="+activeRecordID,
|
2028 |
+
method: 'post',
|
2029 |
+
success: function (res) {
|
2030 |
+
resetMediaAndPosts();
|
2031 |
+
ajaxAnimation();
|
2032 |
+
}
|
2033 |
+
});
|
2034 |
+
} else {
|
2035 |
+
nonce = jQuery.trim($("#wcp_folder_" + $(this).val()).data("nonce"));
|
2036 |
+
jQuery.ajax({
|
2037 |
+
url: wcp_settings.ajax_url,
|
2038 |
+
data: "post_ids=" + checkStr + "&type=" + wcp_settings.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + $(this).val() + "&nonce=" + nonce + "&status=" + wcp_settings.taxonomy_status + "&taxonomy=" + activeRecordID,
|
2039 |
+
method: 'post',
|
2040 |
+
success: function (res) {
|
2041 |
+
res = jQuery.parseJSON(res);
|
2042 |
+
$("#bulk-move-folder").hide();
|
2043 |
+
if (res.status == "1") {
|
2044 |
+
resetMediaAndPosts();
|
2045 |
+
ajaxAnimation();
|
2046 |
+
} else {
|
2047 |
+
$(".folder-popup-form").hide();
|
2048 |
+
$(".folder-popup-form").removeClass("disabled");
|
2049 |
+
$("#error-folder-popup-message").html(res.message);
|
2050 |
+
$("#error-folder-popup").show()
|
2051 |
+
}
|
2052 |
+
}
|
2053 |
+
});
|
2054 |
+
}
|
2055 |
+
}
|
2056 |
+
});
|
2057 |
+
});
|
2058 |
+
|
2059 |
+
var resetMediaFlag = null;
|
2060 |
+
|
2061 |
+
function resetMediaData(loadData) {
|
2062 |
+
resetMediaFlag = $.ajax({
|
2063 |
+
url: wcp_settings.ajax_url,
|
2064 |
+
data: "type=" + wcp_settings.post_type + "&action=wcp_get_default_list&active_id="+activeRecordID,
|
2065 |
+
method: 'post',
|
2066 |
+
beforeSend: function() {
|
2067 |
+
if(resetMediaFlag != null) {
|
2068 |
+
resetMediaFlag.abort();
|
2069 |
+
}
|
2070 |
+
},
|
2071 |
+
success: function (res) {
|
2072 |
+
res = $.parseJSON(res);
|
2073 |
+
// $("#js-tree-menu > ul#space_0").html(res.data);
|
2074 |
+
$(".header-posts .total-count").text(res.total_items);
|
2075 |
+
$(".un-categorised-items .total-count").text(res.empty_items);
|
2076 |
+
selectedVal = $("#media-attachment-taxonomy-filter").val();
|
2077 |
+
if(selectedVal != "all" && loadData == 1) {
|
2078 |
+
var wp1 = parent.wp;
|
2079 |
+
if(wp1.media != undefined) {
|
2080 |
+
wp1.media.frame.setState('insert');
|
2081 |
+
if (wp1.media.frame.content.get() !== null) {
|
2082 |
+
wp1.media.frame.content.get().collection.props.set({ignore: (+new Date())});
|
2083 |
+
wp1.media.frame.content.get().options.selection.reset();
|
2084 |
+
} else {
|
2085 |
+
wp1.media.frame.library.props.set({ignore: (+new Date())});
|
2086 |
+
}
|
2087 |
+
}
|
2088 |
+
}
|
2089 |
+
if(res.taxonomies.length) {
|
2090 |
+
if($("#media-attachment-taxonomy-filter").length) {
|
2091 |
+
folders_media_options.terms = res.taxonomies;
|
2092 |
+
var selectedDD = $("#media-attachment-taxonomy-filter");
|
2093 |
+
selectedDD.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>");
|
2094 |
+
$(".media-select-folder").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>");
|
2095 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
2096 |
+
selectedDD.append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].trash_count + ")</option>");
|
2097 |
+
$(".media-select-folder").append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].trash_count + ")</option>");
|
2098 |
+
|
2099 |
+
$("#title_"+res.taxonomies[i].term_id).attr("title", res.taxonomies[i].term_name);
|
2100 |
+
$("#title_"+res.taxonomies[i].term_id+" .title-text").html(res.taxonomies[i].term_name);
|
2101 |
+
}
|
2102 |
+
selectedDD.val(selectedVal);
|
2103 |
+
$(".media-select-folder").val("");
|
2104 |
+
}
|
2105 |
+
if($("select.folder_for_media").length) {
|
2106 |
+
selectedVal = $("select.folder_for_media").val();
|
2107 |
+
$("select.folder_for_media option:not(:first-child):not(:last-child)").remove();
|
2108 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
2109 |
+
$("select.folder_for_media option:last-child").before("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name +"</option>");
|
2110 |
+
}
|
2111 |
+
if(selectedVal != "") {
|
2112 |
+
$(".folder_for_media").val(selectedVal);
|
2113 |
+
}
|
2114 |
+
}
|
2115 |
+
$("span.premio-folder-count").text("");
|
2116 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
2117 |
+
if(parseInt(res.taxonomies[i].trash_count) != 0) {
|
2118 |
+
$(".jstree-node[id='" + res.taxonomies[i].term_id + "'] > a.jstree-anchor span.premio-folder-count").text(res.taxonomies[i].trash_count);
|
2119 |
+
$(".sticky-folder-"+res.taxonomies[i].term_id+" .premio-folder-count").text(res.taxonomies[i].trash_count);
|
2120 |
+
}
|
2121 |
+
}
|
2122 |
+
}
|
2123 |
+
|
2124 |
+
if(activeRecordID != "") {
|
2125 |
+
$("#wcp_folder_"+activeRecordID).addClass("active-item");
|
2126 |
+
}
|
2127 |
+
|
2128 |
+
if(isItFromMedia) {
|
2129 |
+
$("#title_"+fileFolderID).trigger("click");
|
2130 |
+
isItFromMedia = false;
|
2131 |
+
}
|
2132 |
+
}
|
2133 |
+
});
|
2134 |
+
}
|
2135 |
+
|
2136 |
+
function setMediaBoxWidth() {
|
2137 |
+
$(".media-frame-content .media-toolbar").width($(".media-frame-content").width() - 20);
|
2138 |
+
}
|
2139 |
+
|
2140 |
+
setMediaBoxWidth();
|
2141 |
+
|
2142 |
+
$(window).resize(function(){
|
2143 |
+
setMediaBoxWidth();
|
2144 |
+
});
|
2145 |
+
|
2146 |
+
$(document).ready(function(){
|
2147 |
+
|
2148 |
+
});
|
2149 |
+
|
2150 |
+
$(document).on("click", ".button.organize-button", function(){
|
2151 |
+
if(!$(".media-frame").hasClass("mode-select")) {
|
2152 |
+
setCookie("media-select-mode", "on", 7);
|
2153 |
+
} else {
|
2154 |
+
eraseCookie("media-select-mode");
|
2155 |
+
}
|
2156 |
+
$("button.button.media-button.select-mode-toggle-button").trigger("click");
|
2157 |
+
if($(".media-frame").hasClass("mode-select")) {
|
2158 |
+
$(".media-info-message").addClass("active");
|
2159 |
+
$(".select-all-item-btn").addClass("active");
|
2160 |
+
} else {
|
2161 |
+
$(".media-info-message, .custom-media-select").removeClass("active");
|
2162 |
+
$(".select-all-item-btn").removeClass("active");
|
2163 |
+
}
|
2164 |
+
});
|
2165 |
+
|
2166 |
+
$(document).on("click", ".select-mode-toggle-button", function(){
|
2167 |
+
setTimeout(function() {
|
2168 |
+
if(!$(".media-frame").hasClass("mode-select")) {
|
2169 |
+
setCookie("media-select-mode", "off", -1);
|
2170 |
+
}
|
2171 |
+
if($(".media-frame").hasClass("mode-select")) {
|
2172 |
+
$(".media-info-message").addClass("active");
|
2173 |
+
$(".select-all-item-btn").addClass("active");
|
2174 |
+
} else {
|
2175 |
+
$(".media-info-message, .custom-media-select").removeClass("active");
|
2176 |
+
$(".select-all-item-btn").removeClass("active");
|
2177 |
+
}
|
2178 |
+
}, 10);
|
2179 |
+
});
|
2180 |
+
|
2181 |
+
$(document).on("click", ".select-all-item-btn", function(){
|
2182 |
+
$("ul.attachments li:not(.selected)").trigger("click");
|
2183 |
+
});
|
2184 |
+
|
2185 |
+
$(document).on("change", ".folder_for_media", function(){
|
2186 |
+
if($(this).val() == "add-folder") {
|
2187 |
+
fileFolderID = 0;
|
2188 |
+
isItFromMedia = true;
|
2189 |
+
addFolder();
|
2190 |
+
// $(".add-new-folder").trigger("click");
|
2191 |
+
//$(this).val("-1");
|
2192 |
+
}
|
2193 |
+
});
|
2194 |
+
|
2195 |
+
function setCookie(name,value,days) {
|
2196 |
+
var expires = "";
|
2197 |
+
if (days) {
|
2198 |
+
var date = new Date();
|
2199 |
+
date.setTime(date.getTime() + (days*24*60*60*1000));
|
2200 |
+
expires = "; expires=" + date.toUTCString();
|
2201 |
+
}
|
2202 |
+
document.cookie = name + "=" + (value || "") + expires + "; path=/";
|
2203 |
+
}
|
2204 |
+
|
2205 |
+
function getCookie(name) {
|
2206 |
+
var nameEQ = name + "=";
|
2207 |
+
var ca = document.cookie.split(';');
|
2208 |
+
for(var i=0;i < ca.length;i++) {
|
2209 |
+
var c = ca[i];
|
2210 |
+
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
2211 |
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
2212 |
+
}
|
2213 |
+
return null;
|
2214 |
+
}
|
2215 |
+
|
2216 |
+
function eraseCookie(name) {
|
2217 |
+
document.cookie = name+'=; Max-Age=-99999999;';
|
2218 |
+
}
|
2219 |
+
|
2220 |
+
function setStickyHeaderForMedia() {
|
2221 |
+
if(!$(".media-position").length) {
|
2222 |
+
$(".media-frame-content .media-toolbar").before("<div class='media-position'></div>")
|
2223 |
+
}
|
2224 |
+
|
2225 |
+
if($(".media-position").length) {
|
2226 |
+
setMediaBoxWidth();
|
2227 |
+
|
2228 |
+
thisPosition = $(".media-position").offset().top - $(window).scrollTop();
|
2229 |
+
if(thisPosition <= 32) {
|
2230 |
+
$(".media-frame-content .media-toolbar").addClass("sticky-media");
|
2231 |
+
$(".media-position").height($(".media-frame-content .media-toolbar").outerHeight());
|
2232 |
+
} else {
|
2233 |
+
$(".media-frame-content .media-toolbar").removeClass("sticky-media");
|
2234 |
+
$(".media-position").height(1);
|
2235 |
+
}
|
2236 |
+
}
|
2237 |
+
}
|
2238 |
+
|
2239 |
+
$(window).scroll(function(){
|
2240 |
+
setStickyHeaderForMedia()
|
2241 |
+
});
|
2242 |
+
} else {
|
2243 |
+
function setStickyHeaderForMedia() {}
|
2244 |
+
}
|
2245 |
+
}));
|
assets/js/folders.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!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){var s,o,a,r="#js-tree-menu",l="",n=!1,d=!1,c=0,p=0,u=0,m=!1,f="",h=[],_=wcp_settings.page_url,g="<li class='grid-view' data-id='__folder_id__' id='folder___folder_id__'><div class='folder-item is-folder' data-id='__folder_id__'><a title='__folder_name__' id='folder_view___folder_id__'class='folder-view __append_class__ has-new-folder'data-id='__folder_id__'><span class='folder item-name'><span id='wcp_folder_text___folder_id__'class='folder-title'>__folder_name__</span></span></a></div></li>";function v(e,t){if(h.length>0)for(i=0;i<h.length;i++)if(parseInt(h[i].folder_id)==parseInt(e))return h[i][t];return""}function w(e){if(h.length>0)for(i=0;i<h.length;i++)if(parseInt(h[i].folder_id)==parseInt(e))return i;return null}function y(){if(e(".media-toolbar").hasClass("media-toolbar-mode-select")&&e("ul.attachments li.selected").length&&(e("ul.attachments li.selected").trigger("click"),e(".select-mode-toggle-button").trigger("click")),""!=f&&(e("#js-tree-menu a.jstree-clicked").length>0||"-1"==l)){if(e("#media-attachment-taxonomy-filter").length){f=f.split(",");for(var t=0;t<f.length;t++)""!=f[t]&&e(".attachments-browser li[data-id='"+f[t]+"']").remove()}f=""}e("#media-attachment-taxonomy-filter").length?z(0):(e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=get_folders_default_list",method:"post",success:function(s){for(s=e.parseJSON(s),e(".header-posts .total-count").text(s.total_items),e(".un-categorised-items .total-count").text(s.empty_items),t=0;t<s.taxonomies.length;t++)e("#title_"+s.taxonomies[t].term_id+" .total-count").length||e("#title_"+s.taxonomies[t].term_id+" .star-icon").before("<span class='total-count'></span>"),e("#title_"+s.taxonomies[t].term_id+" .total-count").text(parseInt(s.taxonomies[t].trash_count));for(e("span.premio-folder-count").text(""),e(".folder-count").text(""),t=0;t<s.taxonomies.length;t++)0!=parseInt(s.taxonomies[t].trash_count)&&(e(".jstree-node[id='"+s.taxonomies[t].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(s.taxonomies[t].trash_count),e(".sticky-folder-"+s.taxonomies[t].term_id+" .premio-folder-count").text(s.taxonomies[t].trash_count))}}),e(".folder-loader-ajax").addClass("active"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(_+" #posts-filter",function(){var t={Title:"",Url:_};history.pushState(t,t.Title,t.Url),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>'),x(),j()}):e("#wpbody").load(_+" #wpbody-content",!1,function(t){var s={Title:"",Url:_};history.pushState(s,s.Title,s.Url),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>'),x()}))}function j(){x(),e(".form-loader-count").css("width","0"),"object"==typeof inlineEditPost&&(inlineEditPost.init(),e("#the-list").on("click",".editinline",function(){e(this).attr("aria-expanded","true"),inlineEditPost.edit(this)}),e(document).on("click",".inline-edit-save .save",function(){var t=e(this).closest("tr").attr("id");t=(t=t.replace("edit-","")).replace("post-",""),inlineEditPost.save(t)}),e(document).on("click",".inline-edit-save .cancel",function(){var t=e(this).closest("tr").attr("id");t=(t=t.replace("edit-","")).replace("post-",""),inlineEditPost.revert(t)})),"attachment"==wcp_settings.post_type&&(e(".move-to-folder-top").length||e("#bulk-action-selector-top").append("<option class='move-to-folder-top' value='move_to_folder'>Move to Folder</option>"),e(".move-to-folder-bottom").length||e("#bulk-action-selector-bottom").append("<option class='move-to-folder-bottom' value='move_to_folder'>Move to Folder</option>"))}function x(){if(h.length&&e("li.jstree-node").each(function(){folderPostId=w(e(this).attr("id")),null!=folderPostId&&(1==h[folderPostId].is_high?e(this).addClass("is-high"):e(this).removeClass("is-high"),1==h[folderPostId].is_sticky?e(this).addClass("is-sticky"):e(this).removeClass("is-sticky"))}),folderId=0,e(".tree-structure ul").html(""),folderStatus=!0,e(".jstree-clicked").length&&(folderID=e(".jstree-clicked").closest(".jstree-node").attr("id"),e(".jstree-node[id='"+folderID+"'] > ul.jstree-children > li.jstree-node").length?(folderStatus=!1,e(".jstree-node[id='"+folderID+"'] > ul.jstree-children > li.jstree-node").each(function(){fID=e(this).attr("id"),fName=e.trim(e("#js-tree-menu").jstree(!0).get_node(fID).text),liHtml=g.replace(/__folder_id__/g,fID),liHtml=liHtml.replace(/__folder_name__/g,fName),selectedClass=e(this).hasClass("is-high")?"is-high":"",liHtml=liHtml.replace(/__append_class__/g,selectedClass),e(".tree-structure ul").append(liHtml)})):e(".jstree-node[id='"+folderID+"']").closest("ul").hasClass("jstree-container-ul")||(folderStatus=!1)),folderStatus&&e("#js-tree-menu > ul > li.jstree-node").each(function(){fID=e(this).attr("id"),fName=e.trim(e("#js-tree-menu").jstree(!0).get_node(fID).text),liHtml=g.replace(/__folder_id__/g,fID),liHtml=liHtml.replace(/__folder_name__/g,fName),selectedClass=e(this).hasClass("is-high")?"is-high":"",liHtml=liHtml.replace(/__append_class__/g,selectedClass),e(".tree-structure ul").append(liHtml)}),N(),"attachment"==wcp_settings.post_type&&(e(".move-to-folder-top").length||e("#bulk-action-selector-top").append("<option class='move-to-folder-top' value='move_to_folder'>Move to Folder</option>"),e(".move-to-folder-bottom").length||e("#bulk-action-selector-bottom").append("<option class='move-to-folder-bottom' value='move_to_folder'>Move to Folder</option>")),e(".sticky-folders .active-item").removeClass("active-item"),e("#js-tree-menu li.jstree-node.active-item").length){var t=e("#js-tree-menu li.jstree-node.active-item").data("folder-id");e(".sticky-folders .sticky-folder-"+t+" a").addClass("active-item")}}function b(){x()}function k(){if(0==o&&a>=10)return e("#folder-limitation-message").html("You've reached the 10 folder limitation!"),e("#no-more-folder-credit").show(),!1;e("#add-update-folder-title").text("Add new folder"),e("#save-folder-data").text("Submit"),e(".folder-form-errors").removeClass("active"),e("#add-update-folder-name").val(""),d&&(c=p,e("#add-update-folder-name").val(e.trim(e("#js-tree-menu").jstree(!0).get_node(p).text)+" #2"),p=e("#"+p+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")?e("#"+p+"_anchor").closest(".jstree-node").parent().parent().attr("id"):0),e("#add-update-folder").removeClass("disabled"),e("#add-update-folder").show(),e("#add-update-folder-name").focus(),e(".dynamic-menu").remove()}function C(){folderName=e.trim(e("#js-tree-menu").jstree(!0).get_node(p).text),parentID=e("#wcp_folder_"+p).closest("li.jstree-node").data("folder-id"),parentID==t&&(parentID=0),e("#update-folder-data").text("Submit"),e(".folder-form-errors").removeClass("active"),e("#update-folder-item-name").val(folderName),e("#update-folder-item").removeClass("disabled"),e("#update-folder-item").show(),e("#update-folder-item-name").focus(),e(".dynamic-menu").remove()}function I(t){var s="Are you sure you want to delete the selected folder?",o="Items in the folder will not be deleted.";if(m=!1,1==t&&e("#folder-hide-show-checkbox").is(":checked")){if(m=!0,0==e("#js-tree-menu input.checkbox:checked").length)return e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html("Please select at least one folder to delete"),void e("#error-folder-popup").show();e("#js-tree-menu input.checkbox:checked").length>1&&(s="Are you sure you want to delete the selected folders?",o="Items in the selected folders will not be deleted.")}e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#remove-folder-item").text("Yes, Delete it!"),e("#remove-folder-message").text(s),e("#remove-folder-notice").text(o),e("#confirm-remove-folder").show(),e("#remove-folder-item").focus()}function S(){e(r).jstree({core:{cache:!1,animation:0,check_callback:function(t,s,o,a,i){if(e("*").removeClass("drag-bot").removeClass("drag-in").removeClass("drag-up"),("move_node"===t||"copy_node"===t)&&i&&i.dnd)switch(i.pos){case"a":i.origin.get_node(i.ref,!0).addClass("drag-bot"),nodeId=e(".drag-bot").attr("id"),e("#jstree-dnd").text("Below "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;case"i":i.origin.get_node(i.ref,!0).addClass("drag-in"),nodeId=e(".drag-in").attr("id"),e("#jstree-dnd").text("Inside "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;case"b":i.origin.get_node(i.ref,!0).addClass("drag-up"),nodeId=e(".drag-up").attr("id"),e("#jstree-dnd").text("Above "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;default:e("#jstree-dnd").text(e("#jstree-dnd").data("txt"))}return!0}},data:{cache:!1},select_node:!1,search:{show_only_matches:!0,case_sensitive:!1,fuzzy:!1},plugins:["dnd","search","contextmenu"],contextmenu:{select_node:0,show_at_node:0,items:function(){return{}}}}).bind("ready.jstree",function(){e("#js-tree-menu .jstree-node").each(function(){var t=parseInt(e(this).data("count"));t>0&&e(".jstree-node[id='"+e(this).attr("id")+"'] > a span.premio-folder-count").text(t);var s={folder_id:e(this).attr("id"),folder_count:t,is_sticky:e(this).hasClass("is-sticky")?1:0,is_high:e(this).hasClass("is-high")?1:0,nonce:e(this).data("nonce"),slug:e(this).data("slug"),is_deleted:0};h.push(s)}),""!=l&&0!=l&&e(".jstree-node[id='"+l+"']").length&&(e("#js-tree-menu").jstree("select_node",l),e(".sticky-folders .sticky-folder-"+l+" a").length&&e(".sticky-folders .sticky-folder-"+l+" a").addClass("active-item")),e(".ajax-preloader").hide(),e(".js-tree-data").show(),U(),e(".sticky-folders ul > li").length>0&&e(".sticky-folders").addClass("active"),x()}).bind("move_node.jstree",function(t,s){folderMoveId=s.node.id,orderString="",e(".jstree-node[id='"+folderMoveId+"']").closest("ul").children().each(function(){"undefined"!=e(this).attr("id")&&(orderString+=e(this).attr("id")+",")}),e("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")?parentID=e("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().attr("id"):parentID=0,""!=orderString&&(e(".form-loader-count").css("width","100%"),jQuery.ajax({url:wcp_settings.ajax_url,data:"term_ids="+orderString+"&action=wcp_save_folder_order&type="+wcp_settings.post_type+"&nonce="+wcp_settings.nonce+"&term_id="+folderMoveId+"&parent_id="+parentID,method:"post",success:function(t){"1"==(t=jQuery.parseJSON(t)).status?(e("#wcp_folder_parent").html(t.options),e(".form-loader-count").css("width","0"),b(),y(),H()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show(),window.location.reload(!0))}}))})}function D(){var t=e.trim(e("#folder-search").val());e("#js-tree-menu").jstree("search",t)}function P(e){jQuery.ajax({url:wcp_settings.ajax_url,type:"post",data:"action=save_folder_last_status&post_type="+wcp_settings.post_type+"&post_id="+e+"&nonce="+wcp_settings.nonce,cache:!1,async:!1,success:function(){}})}function T(){setTimeout(function(){if(currentStatus=!0,e("#js-tree-menu .jstree-node.jstree-leaf").length==e("#js-tree-menu .jstree-node").length)e("#expand-collapse-list").removeClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Expand");else{var t=e("#js-tree-menu .jstree-node.jstree-closed").length+e("#js-tree-menu .jstree-node.jstree-open").length;e("#js-tree-menu .jstree-node.jstree-closed").length==t?(e("#expand-collapse-list").removeClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Expand")):(e("#expand-collapse-list").addClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Collapse"))}},500)}function N(){0==e(".tree-structure-content .tree-structure li").length?e(".tree-structure-content").hide():(e(".tree-structure-content").show(),oldHeight=e(".tree-structure-content .tree-structure").height(),e(".tree-structure-content .tree-structure").height("auto"),e(".tree-structure-content .tree-structure").height()>56?e(".folders-toggle-button").show():e(".folders-toggle-button").hide(),newHeight=e(".tree-structure-content .tree-structure").height(),e(".tree-structure-content .tree-structure").attr("data-height",newHeight),e(".tree-structure-content").hasClass("active")?(e(".tree-structure-content .tree-structure").height(newHeight),e(".tree-structure-content .tree-structure").attr("data-height",newHeight)):e(".tree-structure-content .tree-structure").height(oldHeight))}function H(){e(".folder-loader-ajax").addClass("active"),e(".folder-loader-ajax img").removeClass("active"),e(".folder-loader-ajax svg#successAnimation").addClass("active").addClass("animated"),setTimeout(function(){e(".folder-loader-ajax").removeClass("active"),e(".folder-loader-ajax img").addClass("active"),e(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated")},2e3)}function U(){e(".sticky-folders > ul").html("");var t="";if(e("#js-tree-menu li.jstree-node.is-sticky").each(function(){var s=e(this).attr("id"),o=e.trim(e("#js-tree-menu").jstree(!0).get_node(s).text),a=e("li.jstree-node[id='"+s+"'] > a span.premio-folder-count").text(),i=e("li.jstree-node[id='"+s+"']").hasClass("is-high")?" is-high ":"";t+="<li data-folder-id='"+s+"' class='sticky-fldr "+i+" sticky-folder-"+s+"'><a href='javascript:;'><span class='folder-title'>"+o+"</span><span class='folder-actions'><span class='update-inline-record'><i class='pfolder-edit-folder'></i></span><span class='star-icon'><i class='pfolder-star'></i></span><span class='premio-folder-count'>"+a+"</span></span></a></li>"}),e(".sticky-folders > ul").html(t),e(".jstree-anchor.jstree-clicked").length){var s=e(".jstree-anchor.jstree-clicked").closest("li.jstree-node").attr("id");e(".sticky-folders .sticky-folder-"+s+" a").addClass("active-item")}e(".sticky-folders > ul > li").length>0?e(".sticky-folders").addClass("active"):e(".sticky-folders").removeClass("active")}if(e(document).ready(function(){o=parseInt(wcp_settings.is_key_active),a=parseInt(wcp_settings.folders),l=parseInt(wcp_settings.selected_taxonomy),S();var t="1"==wcp_settings.isRTL||1==wcp_settings.isRTL?"w":"e";e(".wcp-content").resizable({resizeHeight:!1,handles:t,minWidth:100,maxWidth:500,resize:function(t,s){var o=s.size.width;for(o<=275?e(".plugin-button").addClass("d-block"):e(".plugin-button").removeClass("d-block"),o<=225&&(o=225),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right",o+20+"px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left",o+20+"px"),newWidth=o-40,cssString="",classString="",i=0;i<=15;i++)classString+=" .space > .jstree-node >",currentWidth=newWidth-(13+20*i),cssString+="#js-tree-menu > "+classString+" .title { width: "+currentWidth+"px !important; } ",cssString+="#js-tree-menu > "+classString+" .dynamic-menu { left: "+(currentWidth-190)+"px !important; } ";e("#wcp-custom-style").html("<style>"+cssString+"</style>"),s.size.width<=185?(folderStatus="hide",e(".wcp-hide-show-buttons .toggle-buttons.show-folders").addClass("active"),e(".wcp-hide-show-buttons .toggle-buttons.hide-folders").removeClass("active"),e("#wcp-content").addClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right","20px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left","20px")):e("#wcp-content").hasClass("hide-folders-area")&&(folderStatus="show",e(".wcp-hide-show-buttons .toggle-buttons.show-folders").removeClass("active"),e(".wcp-hide-show-buttons .toggle-buttons.hide-folders").addClass("active"),e("#wcp-content").addClass("no-transition"),e("#wcp-content").removeClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right",wcp_settings.folder_width+20+"px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left",wcp_settings.folder_width+20+"px"),setTimeout(function(){e("#wcp-content").removeClass("no-transition")},250))},stop:function(t,o){var a=o.size.width;o.size.width<=275?e(".plugin-button").addClass("d-block"):e(".plugin-button").removeClass("d-block"),a<=225&&(a=225),o.size.width<=185?(folderStatus="hide",e(".wcp-hide-show-buttons .toggle-buttons.show-folders").addClass("active"),e(".wcp-hide-show-buttons .toggle-buttons.hide-folders").removeClass("active"),e("#wcp-content").addClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right","20px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left","20px"),e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_folder_display_status&status="+folderStatus+"&nonce="+s,method:"post",success:function(e){}})):e("#wcp-content").hasClass("hide-folders-area")&&(folderStatus="show",e(".wcp-hide-show-buttons .toggle-buttons.show-folders").removeClass("active"),e(".wcp-hide-show-buttons .toggle-buttons.hide-folders").addClass("active"),e("#wcp-content").addClass("no-transition"),e("#wcp-content").removeClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right",wcp_settings.folder_width+20+"px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left",wcp_settings.folder_width+20+"px"),setTimeout(function(){e("#wcp-content").removeClass("no-transition")},250)),s=wcp_settings.nonce,wcp_settings.folder_width=o.size.width,e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_post_width&width="+a+"&nonce="+s,method:"post",success:function(e){}}),o.size.width<=225&&(e(".wcp-content").width(225),wcp_settings.folder_width=225)}}),e(document).on("contextmenu",".jstree-anchor",function(t){return e(this).find("span.folder-inline-edit").trigger("click"),!1}),e(document).on("click",".folder-actions span.folder-inline-edit",function(t){t.stopImmediatePropagation(),t.stopPropagation(),0!=wcp_settings.can_manage_folder&&(isHigh=e(this).closest("li.jstree-node").hasClass("is-high"),isSticky=e(this).closest("li.jstree-node").hasClass("is-sticky"),isStickyClass=!!isSticky,e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span> Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(isHigh?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",hasPosts=parseInt(e(this).closest("a.jstree-anchor").find(".premio-folder-count").text()),"attachment"==wcp_settings.post_type&&hasPosts&&(menuHtml+="<li target='_blank' class='download-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",e(this).closest("a.jstree-anchor").after(menuHtml),e(this).parents("li.jstree-node").addClass("active-menu"),e(this).offset().top+e(".dynamic-menu").height()>e(window).height()-20&&(e(".dynamic-menu").addClass("bottom-fix"),e(".dynamic-menu.bottom-fix").offset().top<e("#custom-scroll-menu").offset().top&&e(".dynamic-menu").removeClass("bottom-fix")))}),e(document).on("click",".sticky-folders .sticky-fldr > a",function(t){t.stopPropagation();var s=e(this).closest("li").data("folder-id");e(".jstree-node[id='"+s+"']").length&&(e(".jstree-clicked").removeClass("jstree-clicked"),e(".active-item").removeClass("active-item"),e("#js-tree-menu").jstree("select_node",l),e(".jstree-node[id='"+s+"'] > a.jstree-anchor").trigger("click"),e(".jstree-node[id='"+s+"'] > a.jstree-anchor").addClass("jstree-clicked"),e(".sticky-folders .sticky-folder-"+s+" a").addClass("active-item"))}),e(document).on("contextmenu",".sticky-folders li .sticky-fldr > a",function(t){return e(this).find("span.update-inline-record").trigger("click"),!1}),e(document).on("click",".update-inline-record",function(t){t.stopImmediatePropagation(),t.stopPropagation(),0!=wcp_settings.can_manage_folder&&(isHigh=e(this).closest("li.sticky-fldr").hasClass("is-high"),isSticky=e(this).closest("li.sticky-fldr").hasClass("is-sticky"),isStickyClass=!!isSticky,e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(isHigh?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",hasPosts=parseInt(e(this).closest("li.jstree-node").find("h3.title:first > .total-count").text()),"attachment"==wcp_settings.post_type&&hasPosts&&(menuHtml+="<li class='download-folder'><a target='_blank' href='"+wcp_settings.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",e(this).closest("li").append(menuHtml),e(this).offset().top+e(".dynamic-menu").height()>e(window).height()-20&&(e(".dynamic-menu").addClass("bottom-fix"),e(".dynamic-menu.bottom-fix").offset().top<e("#custom-scroll-menu").offset().top&&e(".dynamic-menu").removeClass("bottom-fix")))}),e(document).on("click",".dynamic-menu",function(e){e.stopImmediatePropagation(),e.stopPropagation()}),e(document).on("click","body, html",function(){e(".dynamic-menu").remove()}),e(".wcp-hide-show-buttons .toggle-buttons").click(function(){var t="show";e(this).hasClass("hide-folders")&&(t="hide"),e(".wcp-hide-show-buttons .toggle-buttons").toggleClass("active"),s=wcp_settings.nonce,"show"==t?(e("#wcp-content").addClass("no-transition"),e("#wcp-content").removeClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right",wcp_settings.folder_width+20+"px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left",wcp_settings.folder_width+20+"px"),setTimeout(function(){e("#wcp-content").removeClass("no-transition")},250)):(e("#wcp-content").addClass("hide-folders-area"),"1"==wcp_settings.isRTL?(e("#wpcontent").css("padding-right","20px"),e("#wpcontent").css("padding-left","0px")):e("#wpcontent").css("padding-left","20px")),e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_folder_display_status&status="+t+"&nonce="+s,method:"post",success:function(e){}})}),e(".jstree-anchor").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){folderID=e(this).closest("li.jstree-node").attr("id"),o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),s=v(folderID,"nonce"),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?y():(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,s=v(folderID,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?y():(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,s=v(folderID,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),f=chkStr,e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){y()}}))}})}),e(".un-categorised-items").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){folderID=-1,s=wcp_settings.nonce,o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),e.ajax({url:wcp_settings.ajax_url,data:"post_id="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){y()}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,chkStr=postID+",",e(".wp-list-table input:checked").each(function(){postID!=e(this).val()&&(chkStr+=e(this).val()+",")}),e.ajax({url:wcp_settings.ajax_url,data:"post_id="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){y()}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),f=chkStr,e.ajax({url:wcp_settings.ajax_url,data:"post_id="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){y()}}))}})}),e(".attachments-browser li.attachment").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:function(t,s){return e(".selected-items").remove(),selectedItems=e(".attachments-browser li.attachment.selected").length,selectedItems=0==selectedItems||1==selectedItems?"1 Item":selectedItems+" Items",e("<div class='selected-items'><span class='total-post-count'>"+selectedItems+" Selected</span></div>")},start:function(t,s){e("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(t,s){e(".selected-items").remove(),e("body").removeClass("no-hover-css")}})}),e(".tree-structure .folder-item").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){e("body").removeClass("no-hover-css"),folderID=e(this).data("id"),o.draggable.hasClass("wcp-move-multiple")?(s=v(folderID,"nonce"),e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){y(),H()}}))):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,s=v(folderID,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){y(),H()}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,s=v(folderID,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),e.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){y(),H()}}))}})}),e(".sticky-folders li a").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){folderID=e(this).closest("li").data("folder-id"),o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),s=v(folderID,"nonce"),jQuery.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){"1"==(t=jQuery.parseJSON(t)).status?(y(),H()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,s=v(folderID,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),jQuery.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){"1"==(t=jQuery.parseJSON(t)).status?(y(),H()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,s=v(folderID,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),f=chkStr,jQuery.ajax({url:wcp_settings.ajax_url,data:"post_ids="+chkStr+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+folderID+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){y(),H()}}))}})})}),e(window).on("resize",function(){}),e(window).scroll(function(){}),e(document).ready(function(){e("#add-new-folder").livequery(function(){e(this).click(function(){p=e("#js-tree-menu a.jstree-clicked").length?e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"):0,n=!1,k()})}),e(".new-folder").livequery(function(){e(this).click(function(){p=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),n=!1,k()})}),e(".duplicate-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),p=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),e(".dynamic-menu").remove(),n=!1,d=!0,k(),b()})}),e(document).on("submit","#save-folder-form",function(t){if(t.stopPropagation(),t.preventDefault(),folderNameDynamic=e.trim(e("#add-update-folder-name").val()),""==e.trim(folderNameDynamic))e(".folder-form-errors").addClass("active"),e("#add-update-folder-name").focus();else{e("#save-folder-data").html('<span class="dashicons dashicons-update"></span>'),e("#add-update-folder").addClass("disabled");var s=p;n&&(s=0),u=0==s?e("#js-tree-menu > ul > li.jstree-node").length:e("#js-tree-menu > ul > li.jstree-node[id='"+s+"'] > ul.jstree-children > li").length+1,e.ajax({url:wcp_settings.ajax_url,data:{parent_id:s,type:wcp_settings.post_type,action:"wcp_add_new_folder",nonce:wcp_settings.nonce,term_id:s,order:u,name:folderNameDynamic,is_duplicate:d,duplicate_from:c},method:"post",success:function(t){if(result=e.parseJSON(t),"1"==result.status){o=parseInt(result.is_key_active),a=parseInt(result.folders),e("#current-folder").text(a),e("#ttl-fldr").text(10),T(),b(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled");var s={folder_id:result.term_id,folder_count:0,is_sticky:0,is_high:0,nonce:result.nonce,slug:result.slug,is_deleted:0};h.push(s),H(),U(),e("#js-tree-menu").jstree().create_node(result.parent_id,{id:result.term_id,text:" "+result.title},"last",function(){e(".jstree-node[id='"+result.term_id+"']").attr("data-nonce",result.nonce),e(".jstree-node[id='"+result.term_id+"']").attr("data-slug",result.slug)}),e("#media-attachment-taxonomy-filter").length&&(p=result.term_id,z(0))}else e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(result.message),e("#error-folder-popup").show()}})}return!1})}),e(document).ready(function(){e("#inline-update").click(function(){e("#js-tree-menu a.jstree-clicked").length&&(p=e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"),C())}),e(".rename-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),p=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),C(),e(".dynamic-menu").remove()})}),e(document).on("click",".form-cancel-btn",function(){e(".folder-popup-form").hide()}),e(document).on("click",".folder-popup-form",function(t){e(".folder-popup-form").hide()}),e(document).on("click",".popup-form-content",function(e){e.stopPropagation()}),e(document).on("submit","#update-folder-form",function(o){return o.stopPropagation(),o.preventDefault(),folderNameDynamic=e("#update-folder-item-name").val(),""==e.trim(folderNameDynamic)?(e(".folder-form-errors").addClass("active"),e("#update-folder-item-name").focus()):(e("#update-folder-data").html('<span class="dashicons dashicons-update"></span>'),e("#update-folder-item").addClass("disabled"),s=v(p,"nonce"),parentID=e(".jstree-node[id='"+p+"']").closest("li.jstree-node").attr("id"),parentID==t&&(parentID=0),e.ajax({url:wcp_settings.ajax_url,data:{parent_id:parentID,type:wcp_settings.post_type,action:"wcp_update_folder",nonce:s,term_id:p,order:u,name:folderNameDynamic},method:"post",success:function(t){result=e.parseJSON(t),"1"==result.status?(e("#js-tree-menu").jstree("rename_node",result.id," "+result.term_title),folderPostId=w(result.id),null!=folderPostId&&(h[folderPostId].nonce=result.nonce,h[folderPostId].slug=result.slug),b(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),H(),e("#media-attachment-taxonomy-filter").length&&z(0)):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(result.message),e("#error-folder-popup").show())}})),!1})}),e(document).ready(function(){e("#inline-remove").click(function(){e("#js-tree-menu a.jstree-clicked").length?(p=e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"),I(1),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu")):e("#folder-hide-show-checkbox").is(":checked")&&(e(".dynamic-menu").remove(),I(1))}),e(document).on("click","#folder-hide-show-checkbox",function(){e(this).is(":checked")?e("#js-tree-menu").addClass("show-folder-checkbox"):(e("#js-tree-menu input.checkbox").attr("checked",!1),e("#js-tree-menu").removeClass("show-folder-checkbox"))}),e(document).on("click",".folder-checkbox, .input-checkbox",function(e){e.stopImmediatePropagation(),e.stopPropagation()}),e(".remove-folder").livequery(function(){e(this).click(function(){folderID=e(this).closest("li.jstree-node").data("id"),p=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),I(0),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu")})}),e(document).on("click","#remove-folder-item",function(t){t.stopPropagation(),e(".folder-popup-form").addClass("disabled"),e("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>'),s=v(p,"nonce"),m?function(){if(e("#folder-hide-show-checkbox").is(":checked")&&e("#js-tree-menu input.checkbox:checked").length>0){var t="";e("#js-tree-menu input.checkbox:checked").each(function(){t+=e(this).closest("li.jstree-node").attr("id")+",",e(this).closest("li.jstree-node").hasClass("jstree-clicked")&&!0}),e(".form-loader-count").css("width","100%"),e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_remove_muliple_folder&term_id="+t+"&nonce="+wcp_settings.nonce,method:"post",success:function(t){if(t=e.parseJSON(t),e(".form-loader-count").css("width","0px"),"1"==t.status){for(o=parseInt(t.is_key_active),a=parseInt(t.folders),e("#current-folder").text(a),i=0;i<t.term_ids.length;i++)e("#js-tree-menu").jstree().delete_node(t.term_ids[i]);e("#ttl-fldr").text(10),H(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),y(),U(),H(),e("#js-tree-menu li.jstree-node").removeClass("has-sub-tree"),e("#js-tree-menu li.jstree-node").each(function(){e(this).find("ul.ui-sortable li").length?e(this).addClass("has-sub-tree"):e(this).removeClass("active")}),e("#wcp_folder_"+l).length||(e(".header-posts a").trigger("click"),l=0)}else window.location.reload();e("#folder-hide-show-checkbox").attr("checked",!1),e("#js-tree-menu input.checkbox").attr("checked",!1),e("#js-tree-menu").removeClass("show-folder-checkbox")}})}}():e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_remove_folder&term_id="+p+"&nonce="+s,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?(e("#js-tree-menu").jstree().delete_node(p),o=parseInt(t.is_key_active),a=parseInt(t.folders),e("#current-folder").text(a),e("#ttl-fldr").text(10),e(".sticky-folders .sticky-folder-"+p).remove(),b(),H(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),y(),U(),l==p&&e(".header-posts").trigger("click")):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})})}),e(document).ready(function(){e(".mark-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),e(this).closest("li.jstree-node").length?folderID=e(this).closest("li.jstree-node").attr("id"):folderID=e(this).closest("li.sticky-fldr").data("folder-id"),s=v(folderID,"nonce"),e(".form-loader-count").css("width","100%"),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),e.ajax({url:wcp_settings.ajax_url,data:"term_id="+folderID+"&type="+wcp_settings.post_type+"&action=wcp_mark_un_mark_folder&nonce="+s,method:"post",cache:!1,success:function(t){t=e.parseJSON(t),e(".form-loader-count").css("width","0%"),"1"==t.status?(folderPostId=w(t.id),"1"==t.marked?(e("li.jstree-node[id='"+t.id+"']").addClass("is-high"),e(".sticky-folder-"+t.id).addClass("is-high"),null!=folderPostId&&(h[folderPostId].is_high=1)):(e("li.jstree-node[id='"+t.id+"']").removeClass("is-high"),e(".sticky-folder-"+t.id).removeClass("is-high"),null!=folderPostId&&(h[folderPostId].is_high=0)),b(),H()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})})})}),e(document).ready(function(){e(".jstree-node .jstree-icon").livequery(function(){e(this).click(function(){folderID=e(this).closest("li.jstree-node").attr("id"),e("li.jstree-node[id='"+folderID+"']").hasClass("jstree-open")?folderStatus=0:folderStatus=1,e(".form-loader-count").css("width","100%"),s=v(folderID,"nonce"),T(),jQuery.ajax({url:wcp_settings.ajax_url,data:"is_active="+folderStatus+"&action=save_wcp_folder_state&term_id="+folderID+"&nonce="+s,method:"post",success:function(t){e(".form-loader-count").css("width","0"),"0"==(t=jQuery.parseJSON(t)).status||(e("#wcp_folder_"+folderID).hasClass("active")?(e("#wcp_folder_"+folderID).removeClass("active"),e("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideUp(),folderStatus=0):(e("#wcp_folder_"+folderID).addClass("active"),e("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideDown(),folderStatus=1),H())}})})})}),e(document).ready(function(){e(document).on("click","a.jstree-anchor",function(t){if(t.stopPropagation(),e(".un-categorised-items").removeClass("active-item"),e(".header-posts a").removeClass("active-item"),e("active-item").removeClass("active-item"),l=e(this).closest("li.jstree-node").attr("id"),p=e(this).closest("li.jstree-node").attr("id"),e(".sticky-folders .sticky-folder-"+l+" a").addClass("active-item"),e("#media-attachment-taxonomy-filter").length){var s=e(this).closest("li.jstree-node").attr("id");e("#media-attachment-taxonomy-filter").val(s),e("#media-attachment-taxonomy-filter").trigger("change"),thisSlug=v(s,"slug"),_=wcp_settings.page_url+thisSlug;var o={Title:thisSlug,Url:_};history.pushState(o,o.Title,o.Url),P(thisSlug),e(".custom-media-select").removeClass("active")}else{var a=v(l,"slug");_=wcp_settings.page_url+a,e(".form-loader-count").css("width","100%"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(_+" #posts-filter",function(){var t={Title:a,Url:_};history.pushState(t,t.Title,t.Url),P(a),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),j()}):e("#wpbody").load(_+" #wpbody-content",function(){var t={Title:a,Url:_};history.pushState(t,t.Title,t.Url),P(a),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),j()})}x(),e(".sticky-folders .sticky-folder-"+l+" a").addClass("active-item")}),e(".header-posts").click(function(){if(l="",e(".wcp-container .route").removeClass("active-item"),e(".un-categorised-items").removeClass("active-item"),e(".sticky-folders .active-item").removeClass("active-item"),e(".header-posts a").addClass("active-item"),e(".jstree-clicked").removeClass("jstree-clicked"),e("#media-attachment-taxonomy-filter").length){l="",e("#media-attachment-taxonomy-filter").val("all"),e("#media-attachment-taxonomy-filter").trigger("change");var t={Title:"",Url:wcp_settings.page_url};history.pushState(t,t.Title,t.Url),P("all"),x()}else _=wcp_settings.page_url,e(".form-loader-count").css("width","100%"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(_+" #posts-filter",function(){var t={Title:"",Url:_};history.pushState(t,t.Title,t.Url),P("all"),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),x(),j()}):e("#wpbody").load(_+" #wpbody-content",function(){var t={Title:"",Url:_};history.pushState(t,t.Title,t.Url),P("all"),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),x(),j()})}),e(".un-categorised-items").click(function(){if(l="-1",e(".wcp-container .route").removeClass("active-item"),e(".header-posts a").removeClass("active-item"),e(".un-categorised-items").addClass("active-item"),e(".sticky-folders .active-item").removeClass("active-item"),e(".jstree-clicked").removeClass("jstree-clicked"),e("#media-attachment-taxonomy-filter").length){e("#media-attachment-taxonomy-filter").val("unassigned"),e("#media-attachment-taxonomy-filter").trigger("change");var t={Title:"",Url:wcp_settings.page_url+"-1"};history.pushState(t,t.Title,t.Url),P("-1"),x()}else _=wcp_settings.page_url+"-1",e(".form-loader-count").css("width","100%"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(_+" #posts-filter",function(){var t={Title:"",Url:_};history.pushState(t,t.Title,t.Url),P("-1"),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),x(),j()}):e("#wpbody").load(_+" #wpbody-content",function(){var t={Title:"",Url:_};history.pushState(t,t.Title,t.Url),P("-1"),"show"!=wcp_settings.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),x(),j()})}),e("#expand-collapse-list").click(function(t){t.stopPropagation(),statusType=0,e(this).hasClass("all-open")?(e(this).removeClass("all-open"),statusType=0,e(this).attr("data-folder-tooltip","Expand"),e("#js-tree-menu").jstree("close_all")):(e(this).addClass("all-open"),statusType=1,e(this).attr("data-folder-tooltip","Collapse"),e("#js-tree-menu").jstree("open_all")),f="",e("#js-tree-menu .jstree-node:not(.jstree-leaf)").each(function(){f+=e(this).attr("id")+","}),""!=f&&(e(".form-loader-count").css("width","100%"),s=wcp_settings.nonce,jQuery.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_change_all_status&status="+statusType+"&folders="+f+"&nonce="+s,method:"post",success:function(t){e(".form-loader-count").css("width","0"),"0"==(t=jQuery.parseJSON(t)).status&&(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show(),window.location.reload(!0))}}))}),T()}),e(document).ready(function(){e(document).on("click","body, html",function(){e(".folder-order").removeClass("active")}),e(document).on("click","#sort-order-list",function(t){t.stopPropagation(),e(".folder-order").toggleClass("active")}),e(document).on("click",".folder-sort-menu a",function(t){t.stopPropagation(),t.preventDefault(),e(".form-loader-count").css("width","100%"),e(".folder-order").removeClass("active"),lastOrderStatus=e(this).attr("data-sort"),jQuery.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_folders_by_order&nonce="+wcp_settings.nonce+"&order="+e(this).attr("data-sort"),method:"post",success:function(t){1==(t=jQuery.parseJSON(t)).status&&(e("#js-tree-menu").jstree().destroy(),e("#js-tree-menu").append("<ul></ul>"),e("#js-tree-menu ul").html(t.data),S()),e(".form-loader-count").css("width","0"),x()}})})}),e(document).ready(function(){e(document).on("keyup","#folder-search",function(){D()}),e(document).on("change","#folder-search",function(){D()}),e(document).on("blur","#folder-search",function(){D()})}),e(document).ready(function(){e(".wcp-move-file").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:"clone",cursor:"move",start:function(t,s){e(this).closest("td").addClass("wcp-draggable"),e("body").addClass("no-hover-css")},stop:function(t,s){e(this).closest("td").removeClass("wcp-draggable"),e("body").removeClass("no-hover-css")}})}),e(".wcp-move-multiple").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:function(t,s){return e(".selected-items").remove(),selectedItems=e("#the-list th input:checked").length,selectedItems>0?(selectedItems=0==selectedItems||1==selectedItems?"1 Item":selectedItems+" Items",e("<div class='selected-items'><span class='total-post-count'>"+selectedItems+" Selected</span></div>")):e("<div class='selected-items'><span class='total-post-count'>Select Items to move</span></div>")},start:function(t,s){e("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(t,s){e(".selected-items").remove(),e("body").removeClass("no-hover-css")}})})}),"attachment"==wcp_settings.post_type){e(document).ready(function(){"show"==wcp_settings.show_in_page&&e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div><div class="folders-toggle-button"><span></span></div></div>'),b(),N()}),e(window).on("load",function(){e("button.button.media-button.select-mode-toggle-button").after("<button class='button organize-button'>Bulk Organize</button>"),e(".media-toolbar-secondary").append("<span class='media-info-message'>Drag and drop your media files to the relevant folders</span>"),e(".delete-selected-button").before("<button type='button' class='button button-primary select-all-item-btn'>Select All</button>"),e(".media-toolbar-secondary").after("<div class='custom-media-select'>Move Selected files to: <select class='media-select-folder'></select></div>"),e(".media-toolbar").append("<div style='clear:both;'></div><div class='media-folder-loader'><span>Uploading files</span> <span id='current_upload_files'></span>/<span id='total_upload_files'></span><div class='folder-progress'><div class='folder-meter orange-bg'><span></span></div></div></div>"),e(".wcp-custom-form").length&&(wp.Uploader!==t&&wp.Uploader.queue.on("reset",function(){z(1)}),e(document).ajaxComplete(function(e,t,s){actionName=s.data,"undefined"!=typeof actionName&&actionName.length&&0==actionName.indexOf("action=delete-post&id=")&&z(0)})),setTimeout(function(){docReferrar=document.referrer,-1!=docReferrar.indexOf("wp-admin/upload.php")?(mediaMode=function(e){for(var t=e+"=",s=document.cookie.split(";"),o=0;o<s.length;o++){for(var a=s[o];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return null}("media-select-mode"),"on"==mediaMode&&(e("button.button.media-button.select-mode-toggle-button").trigger("click"),e(".media-frame").hasClass("mode-select")?e(".media-info-message").addClass("active"):e(".media-info-message, .custom-media-select").removeClass("active"))):J("media-select-mode"),z(1)},1e3),e(document).on("click",".attachments-browser ul.attachments .thumbnail",function(){e(".media-toolbar").hasClass("media-toolbar-mode-select")&&(0==e("ul.attachments li.selected").length?e(".custom-media-select").removeClass("active"):e(".custom-media-select").addClass("active"))}),e(document).on("change",".media-select-folder",function(){if(""!=e(this).val()){var t="";e(".attachments-browser li.attachment.selected").each(function(){t+=e(this).attr("data-id")+","}),"-1"==e(this).val()?jQuery.ajax({url:wcp_settings.ajax_url,data:"post_id="+t+"&type="+wcp_settings.post_type+"&action=wcp_remove_post_folder&folder_id="+e(this).val()+"&nonce="+wcp_settings.nonce+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(e){y(),H()}}):(s=jQuery.trim(e("#wcp_folder_"+e(this).val()).data("nonce")),jQuery.ajax({url:wcp_settings.ajax_url,data:"post_ids="+t+"&type="+wcp_settings.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+e(this).val()+"&nonce="+s+"&status="+wcp_settings.taxonomy_status+"&taxonomy="+l,method:"post",success:function(t){t=jQuery.parseJSON(t),e("#bulk-move-folder").hide(),"1"==t.status?(y(),H()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}}))}})});var O=null;function z(s){O=e.ajax({url:wcp_settings.ajax_url,data:"type="+wcp_settings.post_type+"&action=wcp_get_default_list&active_id="+l,method:"post",beforeSend:function(){null!=O&&O.abort()},success:function(o){if(o=e.parseJSON(o),e(".header-posts .total-count").text(o.total_items),e(".un-categorised-items .total-count").text(o.empty_items),selectedVal=e("#media-attachment-taxonomy-filter").val(),"all"!=selectedVal&&1==s){var a=parent.wp;a.media!=t&&(a.media.frame.setState("insert"),null!==a.media.frame.content.get()?(a.media.frame.content.get().collection.props.set({ignore:+new Date}),a.media.frame.content.get().options.selection.reset()):a.media.frame.library.props.set({ignore:+new Date}))}if(o.taxonomies.length){if(e("#media-attachment-taxonomy-filter").length){folders_media_options.terms=o.taxonomies;var r=e("#media-attachment-taxonomy-filter");for(r.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>"),e(".media-select-folder").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>"),i=0;i<o.taxonomies.length;i++)r.append("<option value='"+o.taxonomies[i].term_id+"'>"+o.taxonomies[i].name+" ("+o.taxonomies[i].trash_count+")</option>"),e(".media-select-folder").append("<option value='"+o.taxonomies[i].term_id+"'>"+o.taxonomies[i].name+" ("+o.taxonomies[i].trash_count+")</option>"),e("#title_"+o.taxonomies[i].term_id).attr("title",o.taxonomies[i].term_name),e("#title_"+o.taxonomies[i].term_id+" .title-text").html(o.taxonomies[i].term_name);r.val(selectedVal),e(".media-select-folder").val("")}if(e("select.folder_for_media").length){for(selectedVal=e("select.folder_for_media").val(),e("select.folder_for_media option:not(:first-child):not(:last-child)").remove(),i=0;i<o.taxonomies.length;i++)e("select.folder_for_media option:last-child").before("<option value='"+o.taxonomies[i].term_id+"'>"+o.taxonomies[i].name+"</option>");""!=selectedVal&&e(".folder_for_media").val(selectedVal)}for(e("span.premio-folder-count").text(""),i=0;i<o.taxonomies.length;i++)0!=parseInt(o.taxonomies[i].trash_count)&&(e(".jstree-node[id='"+o.taxonomies[i].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(o.taxonomies[i].trash_count),e(".sticky-folder-"+o.taxonomies[i].term_id+" .premio-folder-count").text(o.taxonomies[i].trash_count))}""!=l&&e("#wcp_folder_"+l).addClass("active-item"),n&&(e("#title_"+p).trigger("click"),n=!1)}})}function Q(){e(".media-frame-content .media-toolbar").width(e(".media-frame-content").width()-20)}function q(e,t,s){var o="";if(s){var a=new Date;a.setTime(a.getTime()+24*s*60*60*1e3),o="; expires="+a.toUTCString()}document.cookie=e+"="+(t||"")+o+"; path=/"}function J(e){document.cookie=e+"=; Max-Age=-99999999;"}Q(),e(window).resize(function(){Q()}),e(document).ready(function(){}),e(document).on("click",".button.organize-button",function(){e(".media-frame").hasClass("mode-select")?J("media-select-mode"):q("media-select-mode","on",7),e("button.button.media-button.select-mode-toggle-button").trigger("click"),e(".media-frame").hasClass("mode-select")?(e(".media-info-message").addClass("active"),e(".select-all-item-btn").addClass("active")):(e(".media-info-message, .custom-media-select").removeClass("active"),e(".select-all-item-btn").removeClass("active"))}),e(document).on("click",".select-mode-toggle-button",function(){setTimeout(function(){e(".media-frame").hasClass("mode-select")||q("media-select-mode","off",-1),e(".media-frame").hasClass("mode-select")?(e(".media-info-message").addClass("active"),e(".select-all-item-btn").addClass("active")):(e(".media-info-message, .custom-media-select").removeClass("active"),e(".select-all-item-btn").removeClass("active"))},10)}),e(document).on("click",".select-all-item-btn",function(){e("ul.attachments li:not(.selected)").trigger("click")}),e(document).on("change",".folder_for_media",function(){"add-folder"==e(this).val()&&(p=0,n=!0,k())}),e(window).scroll(function(){})}else;});
|
assets/js/jstree.js
ADDED
@@ -0,0 +1,8701 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*globals jQuery, define, module, exports, require, window, document, postMessage */
|
2 |
+
(function (factory) {
|
3 |
+
"use strict";
|
4 |
+
if (typeof define === 'function' && define.amd) {
|
5 |
+
define(['jquery'], factory);
|
6 |
+
}
|
7 |
+
else if(typeof module !== 'undefined' && module.exports) {
|
8 |
+
module.exports = factory(require('jquery'));
|
9 |
+
}
|
10 |
+
else {
|
11 |
+
factory(jQuery);
|
12 |
+
}
|
13 |
+
}(function ($, undefined) {
|
14 |
+
"use strict";
|
15 |
+
/*!
|
16 |
+
* jsTree 3.3.10
|
17 |
+
* http://jstree.com/
|
18 |
+
*
|
19 |
+
* Copyright (c) 2014 Ivan Bozhanov (http://vakata.com)
|
20 |
+
*
|
21 |
+
* Licensed same as jquery - under the terms of the MIT License
|
22 |
+
* http://www.opensource.org/licenses/mit-license.php
|
23 |
+
*/
|
24 |
+
/*!
|
25 |
+
* if using jslint please allow for the jQuery global and use following options:
|
26 |
+
* jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true
|
27 |
+
*/
|
28 |
+
/*jshint -W083 */
|
29 |
+
|
30 |
+
// prevent another load? maybe there is a better way?
|
31 |
+
if($.jstree) {
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* ### jsTree core functionality
|
37 |
+
*/
|
38 |
+
|
39 |
+
// internal variables
|
40 |
+
var instance_counter = 0,
|
41 |
+
ccp_node = false,
|
42 |
+
ccp_mode = false,
|
43 |
+
ccp_inst = false,
|
44 |
+
themes_loaded = [],
|
45 |
+
src = $('script:last').attr('src'),
|
46 |
+
document = window.document; // local variable is always faster to access then a global
|
47 |
+
|
48 |
+
var setImmediate = window.setImmediate;
|
49 |
+
var Promise = window.Promise;
|
50 |
+
if (!setImmediate && Promise) {
|
51 |
+
// Good enough approximation of setImmediate
|
52 |
+
setImmediate = function (cb, arg) {
|
53 |
+
Promise.resolve(arg).then(cb);
|
54 |
+
};
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* holds all jstree related functions and variables, including the actual class and methods to create, access and manipulate instances.
|
59 |
+
* @name $.jstree
|
60 |
+
*/
|
61 |
+
$.jstree = {
|
62 |
+
/**
|
63 |
+
* specifies the jstree version in use
|
64 |
+
* @name $.jstree.version
|
65 |
+
*/
|
66 |
+
version : '3.3.10',
|
67 |
+
/**
|
68 |
+
* holds all the default options used when creating new instances
|
69 |
+
* @name $.jstree.defaults
|
70 |
+
*/
|
71 |
+
defaults : {
|
72 |
+
/**
|
73 |
+
* configure which plugins will be active on an instance. Should be an array of strings, where each element is a plugin name. The default is `[]`
|
74 |
+
* @name $.jstree.defaults.plugins
|
75 |
+
*/
|
76 |
+
plugins : []
|
77 |
+
},
|
78 |
+
/**
|
79 |
+
* stores all loaded jstree plugins (used internally)
|
80 |
+
* @name $.jstree.plugins
|
81 |
+
*/
|
82 |
+
plugins : {},
|
83 |
+
path : src && src.indexOf('/') !== -1 ? src.replace(/\/[^\/]+$/,'') : '',
|
84 |
+
idregex : /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,
|
85 |
+
root : '#'
|
86 |
+
};
|
87 |
+
|
88 |
+
/**
|
89 |
+
* creates a jstree instance
|
90 |
+
* @name $.jstree.create(el [, options])
|
91 |
+
* @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector
|
92 |
+
* @param {Object} options options for this instance (extends `$.jstree.defaults`)
|
93 |
+
* @return {jsTree} the new instance
|
94 |
+
*/
|
95 |
+
$.jstree.create = function (el, options) {
|
96 |
+
var tmp = new $.jstree.core(++instance_counter),
|
97 |
+
opt = options;
|
98 |
+
options = $.extend(true, {}, $.jstree.defaults, options);
|
99 |
+
if(opt && opt.plugins) {
|
100 |
+
options.plugins = opt.plugins;
|
101 |
+
}
|
102 |
+
$.each(options.plugins, function (i, k) {
|
103 |
+
if(i !== 'core') {
|
104 |
+
tmp = tmp.plugin(k, options[k]);
|
105 |
+
}
|
106 |
+
});
|
107 |
+
$(el).data('jstree', tmp);
|
108 |
+
tmp.init(el, options);
|
109 |
+
return tmp;
|
110 |
+
};
|
111 |
+
/**
|
112 |
+
* remove all traces of jstree from the DOM and destroy all instances
|
113 |
+
* @name $.jstree.destroy()
|
114 |
+
*/
|
115 |
+
$.jstree.destroy = function () {
|
116 |
+
$('.jstree:jstree').jstree('destroy');
|
117 |
+
$(document).off('.jstree');
|
118 |
+
};
|
119 |
+
/**
|
120 |
+
* the jstree class constructor, used only internally
|
121 |
+
* @private
|
122 |
+
* @name $.jstree.core(id)
|
123 |
+
* @param {Number} id this instance's index
|
124 |
+
*/
|
125 |
+
$.jstree.core = function (id) {
|
126 |
+
this._id = id;
|
127 |
+
this._cnt = 0;
|
128 |
+
this._wrk = null;
|
129 |
+
this._data = {
|
130 |
+
core : {
|
131 |
+
themes : {
|
132 |
+
name : false,
|
133 |
+
dots : false,
|
134 |
+
icons : false,
|
135 |
+
ellipsis : false
|
136 |
+
},
|
137 |
+
selected : [],
|
138 |
+
last_error : {},
|
139 |
+
working : false,
|
140 |
+
worker_queue : [],
|
141 |
+
focused : null
|
142 |
+
}
|
143 |
+
};
|
144 |
+
};
|
145 |
+
/**
|
146 |
+
* get a reference to an existing instance
|
147 |
+
*
|
148 |
+
* __Examples__
|
149 |
+
*
|
150 |
+
* // provided a container with an ID of "tree", and a nested node with an ID of "branch"
|
151 |
+
* // all of there will return the same instance
|
152 |
+
* $.jstree.reference('tree');
|
153 |
+
* $.jstree.reference('#tree');
|
154 |
+
* $.jstree.reference($('#tree'));
|
155 |
+
* $.jstree.reference(document.getElementByID('tree'));
|
156 |
+
* $.jstree.reference('branch');
|
157 |
+
* $.jstree.reference('#branch');
|
158 |
+
* $.jstree.reference($('#branch'));
|
159 |
+
* $.jstree.reference(document.getElementByID('branch'));
|
160 |
+
*
|
161 |
+
* @name $.jstree.reference(needle)
|
162 |
+
* @param {DOMElement|jQuery|String} needle
|
163 |
+
* @return {jsTree|null} the instance or `null` if not found
|
164 |
+
*/
|
165 |
+
$.jstree.reference = function (needle) {
|
166 |
+
var tmp = null,
|
167 |
+
obj = null;
|
168 |
+
if(needle && needle.id && (!needle.tagName || !needle.nodeType)) { needle = needle.id; }
|
169 |
+
|
170 |
+
if(!obj || !obj.length) {
|
171 |
+
try { obj = $(needle); } catch (ignore) { }
|
172 |
+
}
|
173 |
+
if(!obj || !obj.length) {
|
174 |
+
try { obj = $('#' + needle.replace($.jstree.idregex,'\\$&')); } catch (ignore) { }
|
175 |
+
}
|
176 |
+
if(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) {
|
177 |
+
tmp = obj;
|
178 |
+
}
|
179 |
+
else {
|
180 |
+
$('.jstree').each(function () {
|
181 |
+
var inst = $(this).data('jstree');
|
182 |
+
if(inst && inst._model.data[needle]) {
|
183 |
+
tmp = inst;
|
184 |
+
return false;
|
185 |
+
}
|
186 |
+
});
|
187 |
+
}
|
188 |
+
return tmp;
|
189 |
+
};
|
190 |
+
/**
|
191 |
+
* Create an instance, get an instance or invoke a command on a instance.
|
192 |
+
*
|
193 |
+
* If there is no instance associated with the current node a new one is created and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken).
|
194 |
+
*
|
195 |
+
* If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function).
|
196 |
+
*
|
197 |
+
* If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`).
|
198 |
+
*
|
199 |
+
* In any other case - nothing is returned and chaining is not broken.
|
200 |
+
*
|
201 |
+
* __Examples__
|
202 |
+
*
|
203 |
+
* $('#tree1').jstree(); // creates an instance
|
204 |
+
* $('#tree2').jstree({ plugins : [] }); // create an instance with some options
|
205 |
+
* $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments
|
206 |
+
* $('#tree2').jstree(); // get an existing instance (or create an instance)
|
207 |
+
* $('#tree2').jstree(true); // get an existing instance (will not create new instance)
|
208 |
+
* $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method)
|
209 |
+
*
|
210 |
+
* @name $().jstree([arg])
|
211 |
+
* @param {String|Object} arg
|
212 |
+
* @return {Mixed}
|
213 |
+
*/
|
214 |
+
$.fn.jstree = function (arg) {
|
215 |
+
// check for string argument
|
216 |
+
var is_method = (typeof arg === 'string'),
|
217 |
+
args = Array.prototype.slice.call(arguments, 1),
|
218 |
+
result = null;
|
219 |
+
if(arg === true && !this.length) { return false; }
|
220 |
+
this.each(function () {
|
221 |
+
// get the instance (if there is one) and method (if it exists)
|
222 |
+
var instance = $.jstree.reference(this),
|
223 |
+
method = is_method && instance ? instance[arg] : null;
|
224 |
+
// if calling a method, and method is available - execute on the instance
|
225 |
+
result = is_method && method ?
|
226 |
+
method.apply(instance, args) :
|
227 |
+
null;
|
228 |
+
// if there is no instance and no method is being called - create one
|
229 |
+
if(!instance && !is_method && (arg === undefined || $.isPlainObject(arg))) {
|
230 |
+
$.jstree.create(this, arg);
|
231 |
+
}
|
232 |
+
// if there is an instance and no method is called - return the instance
|
233 |
+
if( (instance && !is_method) || arg === true ) {
|
234 |
+
result = instance || false;
|
235 |
+
}
|
236 |
+
// if there was a method call which returned a result - break and return the value
|
237 |
+
if(result !== null && result !== undefined) {
|
238 |
+
return false;
|
239 |
+
}
|
240 |
+
});
|
241 |
+
// if there was a method call with a valid return value - return that, otherwise continue the chain
|
242 |
+
return result !== null && result !== undefined ?
|
243 |
+
result : this;
|
244 |
+
};
|
245 |
+
/**
|
246 |
+
* used to find elements containing an instance
|
247 |
+
*
|
248 |
+
* __Examples__
|
249 |
+
*
|
250 |
+
* $('div:jstree').each(function () {
|
251 |
+
* $(this).jstree('destroy');
|
252 |
+
* });
|
253 |
+
*
|
254 |
+
* @name $(':jstree')
|
255 |
+
* @return {jQuery}
|
256 |
+
*/
|
257 |
+
$.expr.pseudos.jstree = $.expr.createPseudo(function(search) {
|
258 |
+
return function(a) {
|
259 |
+
return $(a).hasClass('jstree') &&
|
260 |
+
$(a).data('jstree') !== undefined;
|
261 |
+
};
|
262 |
+
});
|
263 |
+
|
264 |
+
/**
|
265 |
+
* stores all defaults for the core
|
266 |
+
* @name $.jstree.defaults.core
|
267 |
+
*/
|
268 |
+
$.jstree.defaults.core = {
|
269 |
+
/**
|
270 |
+
* data configuration
|
271 |
+
*
|
272 |
+
* If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items).
|
273 |
+
*
|
274 |
+
* You can also pass in a HTML string or a JSON array here.
|
275 |
+
*
|
276 |
+
* It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree.
|
277 |
+
* In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used.
|
278 |
+
*
|
279 |
+
* The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result.
|
280 |
+
*
|
281 |
+
* __Examples__
|
282 |
+
*
|
283 |
+
* // AJAX
|
284 |
+
* $('#tree').jstree({
|
285 |
+
* 'core' : {
|
286 |
+
* 'data' : {
|
287 |
+
* 'url' : '/get/children/',
|
288 |
+
* 'data' : function (node) {
|
289 |
+
* return { 'id' : node.id };
|
290 |
+
* }
|
291 |
+
* }
|
292 |
+
* });
|
293 |
+
*
|
294 |
+
* // direct data
|
295 |
+
* $('#tree').jstree({
|
296 |
+
* 'core' : {
|
297 |
+
* 'data' : [
|
298 |
+
* 'Simple root node',
|
299 |
+
* {
|
300 |
+
* 'id' : 'node_2',
|
301 |
+
* 'text' : 'Root node with options',
|
302 |
+
* 'state' : { 'opened' : true, 'selected' : true },
|
303 |
+
* 'children' : [ { 'text' : 'Child 1' }, 'Child 2']
|
304 |
+
* }
|
305 |
+
* ]
|
306 |
+
* }
|
307 |
+
* });
|
308 |
+
*
|
309 |
+
* // function
|
310 |
+
* $('#tree').jstree({
|
311 |
+
* 'core' : {
|
312 |
+
* 'data' : function (obj, callback) {
|
313 |
+
* callback.call(this, ['Root 1', 'Root 2']);
|
314 |
+
* }
|
315 |
+
* });
|
316 |
+
*
|
317 |
+
* @name $.jstree.defaults.core.data
|
318 |
+
*/
|
319 |
+
data : false,
|
320 |
+
/**
|
321 |
+
* configure the various strings used throughout the tree
|
322 |
+
*
|
323 |
+
* You can use an object where the key is the string you need to replace and the value is your replacement.
|
324 |
+
* Another option is to specify a function which will be called with an argument of the needed string and should return the replacement.
|
325 |
+
* If left as `false` no replacement is made.
|
326 |
+
*
|
327 |
+
* __Examples__
|
328 |
+
*
|
329 |
+
* $('#tree').jstree({
|
330 |
+
* 'core' : {
|
331 |
+
* 'strings' : {
|
332 |
+
* 'Loading ...' : 'Please wait ...'
|
333 |
+
* }
|
334 |
+
* }
|
335 |
+
* });
|
336 |
+
*
|
337 |
+
* @name $.jstree.defaults.core.strings
|
338 |
+
*/
|
339 |
+
strings : false,
|
340 |
+
/**
|
341 |
+
* determines what happens when a user tries to modify the structure of the tree
|
342 |
+
* If left as `false` all operations like create, rename, delete, move or copy are prevented.
|
343 |
+
* You can set this to `true` to allow all interactions or use a function to have better control.
|
344 |
+
*
|
345 |
+
* __Examples__
|
346 |
+
*
|
347 |
+
* $('#tree').jstree({
|
348 |
+
* 'core' : {
|
349 |
+
* 'check_callback' : function (operation, node, node_parent, node_position, more) {
|
350 |
+
* // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node', 'copy_node' or 'edit'
|
351 |
+
* // in case of 'rename_node' node_position is filled with the new node name
|
352 |
+
* return operation === 'rename_node' ? true : false;
|
353 |
+
* }
|
354 |
+
* }
|
355 |
+
* });
|
356 |
+
*
|
357 |
+
* @name $.jstree.defaults.core.check_callback
|
358 |
+
*/
|
359 |
+
check_callback : false,
|
360 |
+
/**
|
361 |
+
* a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc)
|
362 |
+
* @name $.jstree.defaults.core.error
|
363 |
+
*/
|
364 |
+
error : $.noop,
|
365 |
+
/**
|
366 |
+
* the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`)
|
367 |
+
* @name $.jstree.defaults.core.animation
|
368 |
+
*/
|
369 |
+
animation : 200,
|
370 |
+
/**
|
371 |
+
* a boolean indicating if multiple nodes can be selected
|
372 |
+
* @name $.jstree.defaults.core.multiple
|
373 |
+
*/
|
374 |
+
multiple : true,
|
375 |
+
/**
|
376 |
+
* theme configuration object
|
377 |
+
* @name $.jstree.defaults.core.themes
|
378 |
+
*/
|
379 |
+
themes : {
|
380 |
+
/**
|
381 |
+
* the name of the theme to use (if left as `false` the default theme is used)
|
382 |
+
* @name $.jstree.defaults.core.themes.name
|
383 |
+
*/
|
384 |
+
name : false,
|
385 |
+
/**
|
386 |
+
* the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme.
|
387 |
+
* @name $.jstree.defaults.core.themes.url
|
388 |
+
*/
|
389 |
+
url : false,
|
390 |
+
/**
|
391 |
+
* the location of all jstree themes - only used if `url` is set to `true`
|
392 |
+
* @name $.jstree.defaults.core.themes.dir
|
393 |
+
*/
|
394 |
+
dir : false,
|
395 |
+
/**
|
396 |
+
* a boolean indicating if connecting dots are shown
|
397 |
+
* @name $.jstree.defaults.core.themes.dots
|
398 |
+
*/
|
399 |
+
dots : true,
|
400 |
+
/**
|
401 |
+
* a boolean indicating if node icons are shown
|
402 |
+
* @name $.jstree.defaults.core.themes.icons
|
403 |
+
*/
|
404 |
+
icons : true,
|
405 |
+
/**
|
406 |
+
* a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container
|
407 |
+
* @name $.jstree.defaults.core.themes.ellipsis
|
408 |
+
*/
|
409 |
+
ellipsis : false,
|
410 |
+
/**
|
411 |
+
* a boolean indicating if the tree background is striped
|
412 |
+
* @name $.jstree.defaults.core.themes.stripes
|
413 |
+
*/
|
414 |
+
stripes : false,
|
415 |
+
/**
|
416 |
+
* a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants)
|
417 |
+
* @name $.jstree.defaults.core.themes.variant
|
418 |
+
*/
|
419 |
+
variant : false,
|
420 |
+
/**
|
421 |
+
* a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`.
|
422 |
+
* @name $.jstree.defaults.core.themes.responsive
|
423 |
+
*/
|
424 |
+
responsive : false
|
425 |
+
},
|
426 |
+
/**
|
427 |
+
* if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user)
|
428 |
+
* @name $.jstree.defaults.core.expand_selected_onload
|
429 |
+
*/
|
430 |
+
expand_selected_onload : true,
|
431 |
+
/**
|
432 |
+
* if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. Workers are however about 30% slower. Defaults to `true`
|
433 |
+
* @name $.jstree.defaults.core.worker
|
434 |
+
*/
|
435 |
+
worker : true,
|
436 |
+
/**
|
437 |
+
* Force node text to plain text (and escape HTML). Defaults to `false`
|
438 |
+
* @name $.jstree.defaults.core.force_text
|
439 |
+
*/
|
440 |
+
force_text : false,
|
441 |
+
/**
|
442 |
+
* Should the node be toggled if the text is double clicked. Defaults to `true`
|
443 |
+
* @name $.jstree.defaults.core.dblclick_toggle
|
444 |
+
*/
|
445 |
+
dblclick_toggle : true,
|
446 |
+
/**
|
447 |
+
* Should the loaded nodes be part of the state. Defaults to `false`
|
448 |
+
* @name $.jstree.defaults.core.loaded_state
|
449 |
+
*/
|
450 |
+
loaded_state : false,
|
451 |
+
/**
|
452 |
+
* Should the last active node be focused when the tree container is blurred and the focused again. This helps working with screen readers. Defaults to `true`
|
453 |
+
* @name $.jstree.defaults.core.restore_focus
|
454 |
+
*/
|
455 |
+
restore_focus : true,
|
456 |
+
/**
|
457 |
+
* Default keyboard shortcuts (an object where each key is the button name or combo - like 'enter', 'ctrl-space', 'p', etc and the value is the function to execute in the instance's scope)
|
458 |
+
* @name $.jstree.defaults.core.keyboard
|
459 |
+
*/
|
460 |
+
keyboard : {
|
461 |
+
'ctrl-space': function (e) {
|
462 |
+
// aria defines space only with Ctrl
|
463 |
+
e.type = "click";
|
464 |
+
$(e.currentTarget).trigger(e);
|
465 |
+
},
|
466 |
+
'enter': function (e) {
|
467 |
+
// enter
|
468 |
+
e.type = "click";
|
469 |
+
$(e.currentTarget).trigger(e);
|
470 |
+
},
|
471 |
+
'left': function (e) {
|
472 |
+
// left
|
473 |
+
e.preventDefault();
|
474 |
+
if(this.is_open(e.currentTarget)) {
|
475 |
+
this.close_node(e.currentTarget);
|
476 |
+
}
|
477 |
+
else {
|
478 |
+
var o = this.get_parent(e.currentTarget);
|
479 |
+
if(o && o.id !== $.jstree.root) { this.get_node(o, true).children('.jstree-anchor').focus(); }
|
480 |
+
}
|
481 |
+
},
|
482 |
+
'up': function (e) {
|
483 |
+
// up
|
484 |
+
e.preventDefault();
|
485 |
+
var o = this.get_prev_dom(e.currentTarget);
|
486 |
+
if(o && o.length) { o.children('.jstree-anchor').focus(); }
|
487 |
+
},
|
488 |
+
'right': function (e) {
|
489 |
+
// right
|
490 |
+
e.preventDefault();
|
491 |
+
if(this.is_closed(e.currentTarget)) {
|
492 |
+
this.open_node(e.currentTarget, function (o) { this.get_node(o, true).children('.jstree-anchor').focus(); });
|
493 |
+
}
|
494 |
+
else if (this.is_open(e.currentTarget)) {
|
495 |
+
var o = this.get_node(e.currentTarget, true).children('.jstree-children')[0];
|
496 |
+
if(o) { $(this._firstChild(o)).children('.jstree-anchor').focus(); }
|
497 |
+
}
|
498 |
+
},
|
499 |
+
'down': function (e) {
|
500 |
+
// down
|
501 |
+
e.preventDefault();
|
502 |
+
var o = this.get_next_dom(e.currentTarget);
|
503 |
+
if(o && o.length) { o.children('.jstree-anchor').focus(); }
|
504 |
+
},
|
505 |
+
'*': function (e) {
|
506 |
+
// aria defines * on numpad as open_all - not very common
|
507 |
+
this.open_all();
|
508 |
+
},
|
509 |
+
'home': function (e) {
|
510 |
+
// home
|
511 |
+
e.preventDefault();
|
512 |
+
var o = this._firstChild(this.get_container_ul()[0]);
|
513 |
+
if(o) { $(o).children('.jstree-anchor').filter(':visible').focus(); }
|
514 |
+
},
|
515 |
+
'end': function (e) {
|
516 |
+
// end
|
517 |
+
e.preventDefault();
|
518 |
+
this.element.find('.jstree-anchor').filter(':visible').last().focus();
|
519 |
+
},
|
520 |
+
'f2': function (e) {
|
521 |
+
// f2 - safe to include - if check_callback is false it will fail
|
522 |
+
e.preventDefault();
|
523 |
+
this.edit(e.currentTarget);
|
524 |
+
}
|
525 |
+
}
|
526 |
+
};
|
527 |
+
$.jstree.core.prototype = {
|
528 |
+
/**
|
529 |
+
* used to decorate an instance with a plugin. Used internally.
|
530 |
+
* @private
|
531 |
+
* @name plugin(deco [, opts])
|
532 |
+
* @param {String} deco the plugin to decorate with
|
533 |
+
* @param {Object} opts options for the plugin
|
534 |
+
* @return {jsTree}
|
535 |
+
*/
|
536 |
+
plugin : function (deco, opts) {
|
537 |
+
var Child = $.jstree.plugins[deco];
|
538 |
+
if(Child) {
|
539 |
+
this._data[deco] = {};
|
540 |
+
Child.prototype = this;
|
541 |
+
return new Child(opts, this);
|
542 |
+
}
|
543 |
+
return this;
|
544 |
+
},
|
545 |
+
/**
|
546 |
+
* initialize the instance. Used internally.
|
547 |
+
* @private
|
548 |
+
* @name init(el, optons)
|
549 |
+
* @param {DOMElement|jQuery|String} el the element we are transforming
|
550 |
+
* @param {Object} options options for this instance
|
551 |
+
* @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree
|
552 |
+
*/
|
553 |
+
init : function (el, options) {
|
554 |
+
this._model = {
|
555 |
+
data : {},
|
556 |
+
changed : [],
|
557 |
+
force_full_redraw : false,
|
558 |
+
redraw_timeout : false,
|
559 |
+
default_state : {
|
560 |
+
loaded : true,
|
561 |
+
opened : false,
|
562 |
+
selected : false,
|
563 |
+
disabled : false
|
564 |
+
}
|
565 |
+
};
|
566 |
+
this._model.data[$.jstree.root] = {
|
567 |
+
id : $.jstree.root,
|
568 |
+
parent : null,
|
569 |
+
parents : [],
|
570 |
+
children : [],
|
571 |
+
children_d : [],
|
572 |
+
state : { loaded : false }
|
573 |
+
};
|
574 |
+
|
575 |
+
this.element = $(el).addClass('jstree jstree-' + this._id);
|
576 |
+
this.settings = options;
|
577 |
+
|
578 |
+
this._data.core.ready = false;
|
579 |
+
this._data.core.loaded = false;
|
580 |
+
this._data.core.rtl = (this.element.css("direction") === "rtl");
|
581 |
+
this.element[this._data.core.rtl ? 'addClass' : 'removeClass']("jstree-rtl");
|
582 |
+
this.element.attr('role','tree');
|
583 |
+
if(this.settings.core.multiple) {
|
584 |
+
this.element.attr('aria-multiselectable', true);
|
585 |
+
}
|
586 |
+
if(!this.element.attr('tabindex')) {
|
587 |
+
this.element.attr('tabindex','0');
|
588 |
+
}
|
589 |
+
|
590 |
+
this.bind();
|
591 |
+
/**
|
592 |
+
* triggered after all events are bound
|
593 |
+
* @event
|
594 |
+
* @name init.jstree
|
595 |
+
*/
|
596 |
+
this.trigger("init");
|
597 |
+
|
598 |
+
this._data.core.original_container_html = this.element.find(" > ul > li").clone(true);
|
599 |
+
this._data.core.original_container_html
|
600 |
+
.find("li").addBack()
|
601 |
+
.contents().filter(function() {
|
602 |
+
return this.nodeType === 3 && (!this.nodeValue || /^\s+$/.test(this.nodeValue));
|
603 |
+
})
|
604 |
+
.remove();
|
605 |
+
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='presentation'><i class='jstree-icon jstree-ocl'></i><"+"a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden pfolder-folder-close'></i>" + this.get_string("Loading ...") + "</a></li></ul>");
|
606 |
+
this.element.attr('aria-activedescendant','j' + this._id + '_loading');
|
607 |
+
this._data.core.li_height = this.get_container_ul().children("li").first().outerHeight() || 24;
|
608 |
+
this._data.core.node = this._create_prototype_node();
|
609 |
+
/**
|
610 |
+
* triggered after the loading text is shown and before loading starts
|
611 |
+
* @event
|
612 |
+
* @name loading.jstree
|
613 |
+
*/
|
614 |
+
this.trigger("loading");
|
615 |
+
this.load_node($.jstree.root);
|
616 |
+
},
|
617 |
+
/**
|
618 |
+
* destroy an instance
|
619 |
+
* @name destroy()
|
620 |
+
* @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact
|
621 |
+
*/
|
622 |
+
destroy : function (keep_html) {
|
623 |
+
/**
|
624 |
+
* triggered before the tree is destroyed
|
625 |
+
* @event
|
626 |
+
* @name destroy.jstree
|
627 |
+
*/
|
628 |
+
this.trigger("destroy");
|
629 |
+
if(this._wrk) {
|
630 |
+
try {
|
631 |
+
window.URL.revokeObjectURL(this._wrk);
|
632 |
+
this._wrk = null;
|
633 |
+
}
|
634 |
+
catch (ignore) { }
|
635 |
+
}
|
636 |
+
if(!keep_html) { this.element.empty(); }
|
637 |
+
this.teardown();
|
638 |
+
},
|
639 |
+
/**
|
640 |
+
* Create a prototype node
|
641 |
+
* @name _create_prototype_node()
|
642 |
+
* @return {DOMElement}
|
643 |
+
*/
|
644 |
+
_create_prototype_node : function () {
|
645 |
+
var _node = document.createElement('LI'), _temp1, _temp2;
|
646 |
+
_node.setAttribute('role', 'presentation');
|
647 |
+
_temp1 = document.createElement('I');
|
648 |
+
_temp1.className = 'jstree-icon jstree-ocl';
|
649 |
+
_temp1.setAttribute('role', 'presentation');
|
650 |
+
_node.appendChild(_temp1);
|
651 |
+
_temp1 = document.createElement('A');
|
652 |
+
_temp1.className = 'jstree-anchor';
|
653 |
+
_temp1.setAttribute('href','#');
|
654 |
+
_temp1.setAttribute('tabindex','-1');
|
655 |
+
_temp1.setAttribute('role', 'treeitem');
|
656 |
+
_temp2 = document.createElement('I');
|
657 |
+
_temp2.className = 'pfolder-folder-close';
|
658 |
+
_temp2.setAttribute('role', 'presentation');
|
659 |
+
_temp1.appendChild(_temp2);
|
660 |
+
|
661 |
+
var _tempSpan = document.createElement('span');
|
662 |
+
_tempSpan.className = 'folder-checkbox';
|
663 |
+
_temp1.appendChild(_tempSpan);
|
664 |
+
|
665 |
+
var _inputCheck = document.createElement('input');
|
666 |
+
_inputCheck.setAttribute('type', 'checkbox');
|
667 |
+
_inputCheck.setAttribute('class', 'checkbox');
|
668 |
+
_tempSpan.appendChild(_inputCheck);
|
669 |
+
|
670 |
+
var _temp3 = document.createElement('span');
|
671 |
+
_temp3.className = 'folder-actions';
|
672 |
+
_temp1.appendChild(_temp3);
|
673 |
+
|
674 |
+
/* for inline edit */
|
675 |
+
var _temp4 = document.createElement('span');
|
676 |
+
_temp4.className = 'folder-inline-edit';
|
677 |
+
_temp3.appendChild(_temp4);
|
678 |
+
|
679 |
+
var _temp5 = document.createElement('i');
|
680 |
+
_temp5.className = 'pfolder-edit-folder';
|
681 |
+
_temp4.appendChild(_temp5);
|
682 |
+
|
683 |
+
/* for star */
|
684 |
+
var _temp6 = document.createElement('span');
|
685 |
+
_temp6.className = 'star-icon';
|
686 |
+
_temp3.appendChild(_temp6);
|
687 |
+
|
688 |
+
var _temp7 = document.createElement('i');
|
689 |
+
_temp7.className = 'pfolder-star';
|
690 |
+
_temp6.appendChild(_temp7);
|
691 |
+
|
692 |
+
/* for star */
|
693 |
+
var _temp8 = document.createElement('span');
|
694 |
+
_temp8.className = 'sticky-icon';
|
695 |
+
_temp3.appendChild(_temp8);
|
696 |
+
|
697 |
+
var _temp9 = document.createElement('i');
|
698 |
+
_temp9.className = 'pfolder-pin';
|
699 |
+
_temp8.appendChild(_temp9);
|
700 |
+
|
701 |
+
/* for star */
|
702 |
+
var _temp10 = document.createElement('span');
|
703 |
+
_temp10.className = 'premio-folder-count';
|
704 |
+
_temp3.appendChild(_temp10);
|
705 |
+
|
706 |
+
_node.appendChild(_temp1);
|
707 |
+
_temp1 = _temp2 = null;
|
708 |
+
|
709 |
+
return _node;
|
710 |
+
},
|
711 |
+
_kbevent_to_func : function (e) {
|
712 |
+
var keys = {
|
713 |
+
8: "Backspace", 9: "Tab", 13: "Enter", 19: "Pause", 27: "Esc",
|
714 |
+
32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home",
|
715 |
+
37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "Print", 45: "Insert",
|
716 |
+
46: "Delete", 96: "Numpad0", 97: "Numpad1", 98: "Numpad2", 99 : "Numpad3",
|
717 |
+
100: "Numpad4", 101: "Numpad5", 102: "Numpad6", 103: "Numpad7",
|
718 |
+
104: "Numpad8", 105: "Numpad9", '-13': "NumpadEnter", 112: "F1",
|
719 |
+
113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7",
|
720 |
+
119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 144: "Numlock",
|
721 |
+
145: "Scrolllock", 16: 'Shift', 17: 'Ctrl', 18: 'Alt',
|
722 |
+
48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
|
723 |
+
54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
|
724 |
+
66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
|
725 |
+
73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
|
726 |
+
80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
|
727 |
+
87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
|
728 |
+
186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`',
|
729 |
+
219: '[', 220: '\\',221: ']', 222: "'", 111: '/', 106: '*', 173: '-'
|
730 |
+
};
|
731 |
+
var parts = [];
|
732 |
+
if (e.ctrlKey) { parts.push('ctrl'); }
|
733 |
+
if (e.altKey) { parts.push('alt'); }
|
734 |
+
if (e.shiftKey) { parts.push('shift'); }
|
735 |
+
parts.push(keys[e.which] || e.which);
|
736 |
+
parts = parts.sort().join('-').toLowerCase();
|
737 |
+
if (parts === 'shift-shift' || parts === 'ctrl-ctrl' || parts === 'alt-alt') {
|
738 |
+
return null;
|
739 |
+
}
|
740 |
+
|
741 |
+
var kb = this.settings.core.keyboard, i, tmp;
|
742 |
+
for (i in kb) {
|
743 |
+
if (kb.hasOwnProperty(i)) {
|
744 |
+
tmp = i;
|
745 |
+
if (tmp !== '-' && tmp !== '+') {
|
746 |
+
tmp = tmp.replace('--', '-MINUS').replace('+-', '-MINUS').replace('++', '-PLUS').replace('-+', '-PLUS');
|
747 |
+
tmp = tmp.split(/-|\+/).sort().join('-').replace('MINUS', '-').replace('PLUS', '+').toLowerCase();
|
748 |
+
}
|
749 |
+
if (tmp === parts) {
|
750 |
+
return kb[i];
|
751 |
+
}
|
752 |
+
}
|
753 |
+
}
|
754 |
+
return null;
|
755 |
+
},
|
756 |
+
/**
|
757 |
+
* part of the destroying of an instance. Used internally.
|
758 |
+
* @private
|
759 |
+
* @name teardown()
|
760 |
+
*/
|
761 |
+
teardown : function () {
|
762 |
+
this.unbind();
|
763 |
+
this.element
|
764 |
+
.removeClass('jstree')
|
765 |
+
.removeData('jstree')
|
766 |
+
.find("[class^='jstree']")
|
767 |
+
.addBack()
|
768 |
+
.attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
|
769 |
+
this.element = null;
|
770 |
+
},
|
771 |
+
/**
|
772 |
+
* bind all events. Used internally.
|
773 |
+
* @private
|
774 |
+
* @name bind()
|
775 |
+
*/
|
776 |
+
bind : function () {
|
777 |
+
var word = '',
|
778 |
+
tout = null,
|
779 |
+
was_click = 0;
|
780 |
+
this.element
|
781 |
+
.on("dblclick.jstree", function (e) {
|
782 |
+
if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; }
|
783 |
+
if(document.selection && document.selection.empty) {
|
784 |
+
document.selection.empty();
|
785 |
+
}
|
786 |
+
else {
|
787 |
+
if(window.getSelection) {
|
788 |
+
var sel = window.getSelection();
|
789 |
+
try {
|
790 |
+
sel.removeAllRanges();
|
791 |
+
sel.collapse();
|
792 |
+
} catch (ignore) { }
|
793 |
+
}
|
794 |
+
}
|
795 |
+
})
|
796 |
+
.on("mousedown.jstree", $.proxy(function (e) {
|
797 |
+
if(e.target === this.element[0]) {
|
798 |
+
e.preventDefault(); // prevent losing focus when clicking scroll arrows (FF, Chrome)
|
799 |
+
was_click = +(new Date()); // ie does not allow to prevent losing focus
|
800 |
+
}
|
801 |
+
}, this))
|
802 |
+
.on("mousedown.jstree", ".jstree-ocl", function (e) {
|
803 |
+
e.preventDefault(); // prevent any node inside from losing focus when clicking the open/close icon
|
804 |
+
})
|
805 |
+
.on("click.jstree", ".jstree-ocl", $.proxy(function (e) {
|
806 |
+
this.toggle_node(e.target);
|
807 |
+
}, this))
|
808 |
+
.on("dblclick.jstree", ".jstree-anchor", $.proxy(function (e) {
|
809 |
+
if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; }
|
810 |
+
if(this.settings.core.dblclick_toggle) {
|
811 |
+
this.toggle_node(e.target);
|
812 |
+
}
|
813 |
+
}, this))
|
814 |
+
.on("click.jstree", ".jstree-anchor", $.proxy(function (e) {
|
815 |
+
if(e.target.className != 'pfolder-edit-folder' && e.target.className != 'checkbox') {
|
816 |
+
e.preventDefault();
|
817 |
+
if(e.currentTarget !== document.activeElement) { $(e.currentTarget).focus(); }
|
818 |
+
this.activate_node(e.currentTarget, e);
|
819 |
+
}
|
820 |
+
}, this))
|
821 |
+
.on('keydown.jstree', '.jstree-anchor', $.proxy(function (e) {
|
822 |
+
if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; }
|
823 |
+
if(this._data.core.rtl) {
|
824 |
+
if(e.which === 37) { e.which = 39; }
|
825 |
+
else if(e.which === 39) { e.which = 37; }
|
826 |
+
}
|
827 |
+
var f = this._kbevent_to_func(e);
|
828 |
+
if (f) {
|
829 |
+
var r = f.call(this, e);
|
830 |
+
if (r === false || r === true) {
|
831 |
+
return r;
|
832 |
+
}
|
833 |
+
}
|
834 |
+
}, this))
|
835 |
+
.on("load_node.jstree", $.proxy(function (e, data) {
|
836 |
+
if(data.status) {
|
837 |
+
if(data.node.id === $.jstree.root && !this._data.core.loaded) {
|
838 |
+
this._data.core.loaded = true;
|
839 |
+
if(this._firstChild(this.get_container_ul()[0])) {
|
840 |
+
this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id);
|
841 |
+
}
|
842 |
+
/**
|
843 |
+
* triggered after the root node is loaded for the first time
|
844 |
+
* @event
|
845 |
+
* @name loaded.jstree
|
846 |
+
*/
|
847 |
+
this.trigger("loaded");
|
848 |
+
}
|
849 |
+
if(!this._data.core.ready) {
|
850 |
+
setTimeout($.proxy(function() {
|
851 |
+
if(this.element && !this.get_container_ul().find('.jstree-loading').length) {
|
852 |
+
this._data.core.ready = true;
|
853 |
+
if(this._data.core.selected.length) {
|
854 |
+
if(this.settings.core.expand_selected_onload) {
|
855 |
+
var tmp = [], i, j;
|
856 |
+
for(i = 0, j = this._data.core.selected.length; i < j; i++) {
|
857 |
+
tmp = tmp.concat(this._model.data[this._data.core.selected[i]].parents);
|
858 |
+
}
|
859 |
+
tmp = $.vakata.array_unique(tmp);
|
860 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
861 |
+
this.open_node(tmp[i], false, 0);
|
862 |
+
}
|
863 |
+
}
|
864 |
+
this.trigger('changed', { 'action' : 'ready', 'selected' : this._data.core.selected });
|
865 |
+
}
|
866 |
+
/**
|
867 |
+
* triggered after all nodes are finished loading
|
868 |
+
* @event
|
869 |
+
* @name ready.jstree
|
870 |
+
*/
|
871 |
+
this.trigger("ready");
|
872 |
+
}
|
873 |
+
}, this), 0);
|
874 |
+
}
|
875 |
+
}
|
876 |
+
}, this))
|
877 |
+
// quick searching when the tree is focused
|
878 |
+
.on('keypress.jstree', $.proxy(function (e) {
|
879 |
+
if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; }
|
880 |
+
if(tout) { clearTimeout(tout); }
|
881 |
+
tout = setTimeout(function () {
|
882 |
+
word = '';
|
883 |
+
}, 500);
|
884 |
+
|
885 |
+
var chr = String.fromCharCode(e.which).toLowerCase(),
|
886 |
+
col = this.element.find('.jstree-anchor').filter(':visible'),
|
887 |
+
ind = col.index(document.activeElement) || 0,
|
888 |
+
end = false;
|
889 |
+
word += chr;
|
890 |
+
|
891 |
+
// match for whole word from current node down (including the current node)
|
892 |
+
if(word.length > 1) {
|
893 |
+
col.slice(ind).each($.proxy(function (i, v) {
|
894 |
+
if($(v).text().toLowerCase().indexOf(word) === 0) {
|
895 |
+
$(v).focus();
|
896 |
+
end = true;
|
897 |
+
return false;
|
898 |
+
}
|
899 |
+
}, this));
|
900 |
+
if(end) { return; }
|
901 |
+
|
902 |
+
// match for whole word from the beginning of the tree
|
903 |
+
col.slice(0, ind).each($.proxy(function (i, v) {
|
904 |
+
if($(v).text().toLowerCase().indexOf(word) === 0) {
|
905 |
+
$(v).focus();
|
906 |
+
end = true;
|
907 |
+
return false;
|
908 |
+
}
|
909 |
+
}, this));
|
910 |
+
if(end) { return; }
|
911 |
+
}
|
912 |
+
// list nodes that start with that letter (only if word consists of a single char)
|
913 |
+
if(new RegExp('^' + chr.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '+$').test(word)) {
|
914 |
+
// search for the next node starting with that letter
|
915 |
+
col.slice(ind + 1).each($.proxy(function (i, v) {
|
916 |
+
if($(v).text().toLowerCase().charAt(0) === chr) {
|
917 |
+
$(v).focus();
|
918 |
+
end = true;
|
919 |
+
return false;
|
920 |
+
}
|
921 |
+
}, this));
|
922 |
+
if(end) { return; }
|
923 |
+
|
924 |
+
// search from the beginning
|
925 |
+
col.slice(0, ind + 1).each($.proxy(function (i, v) {
|
926 |
+
if($(v).text().toLowerCase().charAt(0) === chr) {
|
927 |
+
$(v).focus();
|
928 |
+
end = true;
|
929 |
+
return false;
|
930 |
+
}
|
931 |
+
}, this));
|
932 |
+
if(end) { return; }
|
933 |
+
}
|
934 |
+
}, this))
|
935 |
+
// THEME RELATED
|
936 |
+
.on("init.jstree", $.proxy(function () {
|
937 |
+
var s = this.settings.core.themes;
|
938 |
+
this._data.core.themes.dots = s.dots;
|
939 |
+
this._data.core.themes.stripes = s.stripes;
|
940 |
+
this._data.core.themes.icons = s.icons;
|
941 |
+
this._data.core.themes.ellipsis = s.ellipsis;
|
942 |
+
this.set_theme(s.name || "default", s.url);
|
943 |
+
this.set_theme_variant(s.variant);
|
944 |
+
}, this))
|
945 |
+
.on("loading.jstree", $.proxy(function () {
|
946 |
+
this[ this._data.core.themes.dots ? "show_dots" : "hide_dots" ]();
|
947 |
+
this[ this._data.core.themes.icons ? "show_icons" : "hide_icons" ]();
|
948 |
+
this[ this._data.core.themes.stripes ? "show_stripes" : "hide_stripes" ]();
|
949 |
+
this[ this._data.core.themes.ellipsis ? "show_ellipsis" : "hide_ellipsis" ]();
|
950 |
+
}, this))
|
951 |
+
.on('blur.jstree', '.jstree-anchor', $.proxy(function (e) {
|
952 |
+
this._data.core.focused = null;
|
953 |
+
$(e.currentTarget).filter('.jstree-hovered').trigger('mouseleave');
|
954 |
+
this.element.attr('tabindex', '0');
|
955 |
+
}, this))
|
956 |
+
.on('focus.jstree', '.jstree-anchor', $.proxy(function (e) {
|
957 |
+
var tmp = this.get_node(e.currentTarget);
|
958 |
+
if(tmp && tmp.id) {
|
959 |
+
this._data.core.focused = tmp.id;
|
960 |
+
}
|
961 |
+
this.element.find('.jstree-hovered').not(e.currentTarget).trigger('mouseleave');
|
962 |
+
$(e.currentTarget).trigger('mouseenter');
|
963 |
+
this.element.attr('tabindex', '-1');
|
964 |
+
}, this))
|
965 |
+
.on('focus.jstree', $.proxy(function () {
|
966 |
+
if(+(new Date()) - was_click > 500 && !this._data.core.focused && this.settings.core.restore_focus) {
|
967 |
+
was_click = 0;
|
968 |
+
var act = this.get_node(this.element.attr('aria-activedescendant'), true);
|
969 |
+
if(act) {
|
970 |
+
act.find('> .jstree-anchor').focus();
|
971 |
+
}
|
972 |
+
}
|
973 |
+
}, this))
|
974 |
+
.on('mouseenter.jstree', '.jstree-anchor', $.proxy(function (e) {
|
975 |
+
this.hover_node(e.currentTarget);
|
976 |
+
}, this))
|
977 |
+
.on('mouseleave.jstree', '.jstree-anchor', $.proxy(function (e) {
|
978 |
+
this.dehover_node(e.currentTarget);
|
979 |
+
}, this));
|
980 |
+
},
|
981 |
+
/**
|
982 |
+
* part of the destroying of an instance. Used internally.
|
983 |
+
* @private
|
984 |
+
* @name unbind()
|
985 |
+
*/
|
986 |
+
unbind : function () {
|
987 |
+
this.element.off('.jstree');
|
988 |
+
$(document).off('.jstree-' + this._id);
|
989 |
+
},
|
990 |
+
/**
|
991 |
+
* trigger an event. Used internally.
|
992 |
+
* @private
|
993 |
+
* @name trigger(ev [, data])
|
994 |
+
* @param {String} ev the name of the event to trigger
|
995 |
+
* @param {Object} data additional data to pass with the event
|
996 |
+
*/
|
997 |
+
trigger : function (ev, data) {
|
998 |
+
if(!data) {
|
999 |
+
data = {};
|
1000 |
+
}
|
1001 |
+
data.instance = this;
|
1002 |
+
this.element.triggerHandler(ev.replace('.jstree','') + '.jstree', data);
|
1003 |
+
},
|
1004 |
+
/**
|
1005 |
+
* returns the jQuery extended instance container
|
1006 |
+
* @name get_container()
|
1007 |
+
* @return {jQuery}
|
1008 |
+
*/
|
1009 |
+
get_container : function () {
|
1010 |
+
return this.element;
|
1011 |
+
},
|
1012 |
+
/**
|
1013 |
+
* returns the jQuery extended main UL node inside the instance container. Used internally.
|
1014 |
+
* @private
|
1015 |
+
* @name get_container_ul()
|
1016 |
+
* @return {jQuery}
|
1017 |
+
*/
|
1018 |
+
get_container_ul : function () {
|
1019 |
+
return this.element.children(".jstree-children").first();
|
1020 |
+
},
|
1021 |
+
/**
|
1022 |
+
* gets string replacements (localization). Used internally.
|
1023 |
+
* @private
|
1024 |
+
* @name get_string(key)
|
1025 |
+
* @param {String} key
|
1026 |
+
* @return {String}
|
1027 |
+
*/
|
1028 |
+
get_string : function (key) {
|
1029 |
+
var a = this.settings.core.strings;
|
1030 |
+
if($.isFunction(a)) { return a.call(this, key); }
|
1031 |
+
if(a && a[key]) { return a[key]; }
|
1032 |
+
return key;
|
1033 |
+
},
|
1034 |
+
/**
|
1035 |
+
* gets the first child of a DOM node. Used internally.
|
1036 |
+
* @private
|
1037 |
+
* @name _firstChild(dom)
|
1038 |
+
* @param {DOMElement} dom
|
1039 |
+
* @return {DOMElement}
|
1040 |
+
*/
|
1041 |
+
_firstChild : function (dom) {
|
1042 |
+
dom = dom ? dom.firstChild : null;
|
1043 |
+
while(dom !== null && dom.nodeType !== 1) {
|
1044 |
+
dom = dom.nextSibling;
|
1045 |
+
}
|
1046 |
+
return dom;
|
1047 |
+
},
|
1048 |
+
/**
|
1049 |
+
* gets the next sibling of a DOM node. Used internally.
|
1050 |
+
* @private
|
1051 |
+
* @name _nextSibling(dom)
|
1052 |
+
* @param {DOMElement} dom
|
1053 |
+
* @return {DOMElement}
|
1054 |
+
*/
|
1055 |
+
_nextSibling : function (dom) {
|
1056 |
+
dom = dom ? dom.nextSibling : null;
|
1057 |
+
while(dom !== null && dom.nodeType !== 1) {
|
1058 |
+
dom = dom.nextSibling;
|
1059 |
+
}
|
1060 |
+
return dom;
|
1061 |
+
},
|
1062 |
+
/**
|
1063 |
+
* gets the previous sibling of a DOM node. Used internally.
|
1064 |
+
* @private
|
1065 |
+
* @name _previousSibling(dom)
|
1066 |
+
* @param {DOMElement} dom
|
1067 |
+
* @return {DOMElement}
|
1068 |
+
*/
|
1069 |
+
_previousSibling : function (dom) {
|
1070 |
+
dom = dom ? dom.previousSibling : null;
|
1071 |
+
while(dom !== null && dom.nodeType !== 1) {
|
1072 |
+
dom = dom.previousSibling;
|
1073 |
+
}
|
1074 |
+
return dom;
|
1075 |
+
},
|
1076 |
+
/**
|
1077 |
+
* get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc)
|
1078 |
+
* @name get_node(obj [, as_dom])
|
1079 |
+
* @param {mixed} obj
|
1080 |
+
* @param {Boolean} as_dom
|
1081 |
+
* @return {Object|jQuery}
|
1082 |
+
*/
|
1083 |
+
get_node : function (obj, as_dom) {
|
1084 |
+
if(obj && obj.id) {
|
1085 |
+
obj = obj.id;
|
1086 |
+
}
|
1087 |
+
if (obj instanceof $ && obj.length && obj[0].id) {
|
1088 |
+
obj = obj[0].id;
|
1089 |
+
}
|
1090 |
+
var dom;
|
1091 |
+
try {
|
1092 |
+
if(this._model.data[obj]) {
|
1093 |
+
obj = this._model.data[obj];
|
1094 |
+
}
|
1095 |
+
else if(typeof obj === "string" && this._model.data[obj.replace(/^#/, '')]) {
|
1096 |
+
obj = this._model.data[obj.replace(/^#/, '')];
|
1097 |
+
}
|
1098 |
+
else if(typeof obj === "string" && (dom = $('#' + obj.replace($.jstree.idregex,'\\$&'), this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) {
|
1099 |
+
obj = this._model.data[dom.closest('.jstree-node').attr('id')];
|
1100 |
+
}
|
1101 |
+
else if((dom = this.element.find(obj)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) {
|
1102 |
+
obj = this._model.data[dom.closest('.jstree-node').attr('id')];
|
1103 |
+
}
|
1104 |
+
else if((dom = this.element.find(obj)).length && dom.hasClass('jstree')) {
|
1105 |
+
obj = this._model.data[$.jstree.root];
|
1106 |
+
}
|
1107 |
+
else {
|
1108 |
+
return false;
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
if(as_dom) {
|
1112 |
+
obj = obj.id === $.jstree.root ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element);
|
1113 |
+
}
|
1114 |
+
return obj;
|
1115 |
+
} catch (ex) { return false; }
|
1116 |
+
},
|
1117 |
+
/**
|
1118 |
+
* get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array)
|
1119 |
+
* @name get_path(obj [, glue, ids])
|
1120 |
+
* @param {mixed} obj the node
|
1121 |
+
* @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned
|
1122 |
+
* @param {Boolean} ids if set to true build the path using ID, otherwise node text is used
|
1123 |
+
* @return {mixed}
|
1124 |
+
*/
|
1125 |
+
get_path : function (obj, glue, ids) {
|
1126 |
+
obj = obj.parents ? obj : this.get_node(obj);
|
1127 |
+
if(!obj || obj.id === $.jstree.root || !obj.parents) {
|
1128 |
+
return false;
|
1129 |
+
}
|
1130 |
+
var i, j, p = [];
|
1131 |
+
p.push(ids ? obj.id : obj.text);
|
1132 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
1133 |
+
p.push(ids ? obj.parents[i] : this.get_text(obj.parents[i]));
|
1134 |
+
}
|
1135 |
+
p = p.reverse().slice(1);
|
1136 |
+
return glue ? p.join(glue) : p;
|
1137 |
+
},
|
1138 |
+
/**
|
1139 |
+
* get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned.
|
1140 |
+
* @name get_next_dom(obj [, strict])
|
1141 |
+
* @param {mixed} obj
|
1142 |
+
* @param {Boolean} strict
|
1143 |
+
* @return {jQuery}
|
1144 |
+
*/
|
1145 |
+
get_next_dom : function (obj, strict) {
|
1146 |
+
var tmp;
|
1147 |
+
obj = this.get_node(obj, true);
|
1148 |
+
if(obj[0] === this.element[0]) {
|
1149 |
+
tmp = this._firstChild(this.get_container_ul()[0]);
|
1150 |
+
while (tmp && tmp.offsetHeight === 0) {
|
1151 |
+
tmp = this._nextSibling(tmp);
|
1152 |
+
}
|
1153 |
+
return tmp ? $(tmp) : false;
|
1154 |
+
}
|
1155 |
+
if(!obj || !obj.length) {
|
1156 |
+
return false;
|
1157 |
+
}
|
1158 |
+
if(strict) {
|
1159 |
+
tmp = obj[0];
|
1160 |
+
do {
|
1161 |
+
tmp = this._nextSibling(tmp);
|
1162 |
+
} while (tmp && tmp.offsetHeight === 0);
|
1163 |
+
return tmp ? $(tmp) : false;
|
1164 |
+
}
|
1165 |
+
if(obj.hasClass("jstree-open")) {
|
1166 |
+
tmp = this._firstChild(obj.children('.jstree-children')[0]);
|
1167 |
+
while (tmp && tmp.offsetHeight === 0) {
|
1168 |
+
tmp = this._nextSibling(tmp);
|
1169 |
+
}
|
1170 |
+
if(tmp !== null) {
|
1171 |
+
return $(tmp);
|
1172 |
+
}
|
1173 |
+
}
|
1174 |
+
tmp = obj[0];
|
1175 |
+
do {
|
1176 |
+
tmp = this._nextSibling(tmp);
|
1177 |
+
} while (tmp && tmp.offsetHeight === 0);
|
1178 |
+
if(tmp !== null) {
|
1179 |
+
return $(tmp);
|
1180 |
+
}
|
1181 |
+
return obj.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first();
|
1182 |
+
},
|
1183 |
+
/**
|
1184 |
+
* get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned.
|
1185 |
+
* @name get_prev_dom(obj [, strict])
|
1186 |
+
* @param {mixed} obj
|
1187 |
+
* @param {Boolean} strict
|
1188 |
+
* @return {jQuery}
|
1189 |
+
*/
|
1190 |
+
get_prev_dom : function (obj, strict) {
|
1191 |
+
var tmp;
|
1192 |
+
obj = this.get_node(obj, true);
|
1193 |
+
if(obj[0] === this.element[0]) {
|
1194 |
+
tmp = this.get_container_ul()[0].lastChild;
|
1195 |
+
while (tmp && tmp.offsetHeight === 0) {
|
1196 |
+
tmp = this._previousSibling(tmp);
|
1197 |
+
}
|
1198 |
+
return tmp ? $(tmp) : false;
|
1199 |
+
}
|
1200 |
+
if(!obj || !obj.length) {
|
1201 |
+
return false;
|
1202 |
+
}
|
1203 |
+
if(strict) {
|
1204 |
+
tmp = obj[0];
|
1205 |
+
do {
|
1206 |
+
tmp = this._previousSibling(tmp);
|
1207 |
+
} while (tmp && tmp.offsetHeight === 0);
|
1208 |
+
return tmp ? $(tmp) : false;
|
1209 |
+
}
|
1210 |
+
tmp = obj[0];
|
1211 |
+
do {
|
1212 |
+
tmp = this._previousSibling(tmp);
|
1213 |
+
} while (tmp && tmp.offsetHeight === 0);
|
1214 |
+
if(tmp !== null) {
|
1215 |
+
obj = $(tmp);
|
1216 |
+
while(obj.hasClass("jstree-open")) {
|
1217 |
+
obj = obj.children(".jstree-children").first().children(".jstree-node:visible:last");
|
1218 |
+
}
|
1219 |
+
return obj;
|
1220 |
+
}
|
1221 |
+
tmp = obj[0].parentNode.parentNode;
|
1222 |
+
return tmp && tmp.className && tmp.className.indexOf('jstree-node') !== -1 ? $(tmp) : false;
|
1223 |
+
},
|
1224 |
+
/**
|
1225 |
+
* get the parent ID of a node
|
1226 |
+
* @name get_parent(obj)
|
1227 |
+
* @param {mixed} obj
|
1228 |
+
* @return {String}
|
1229 |
+
*/
|
1230 |
+
get_parent : function (obj) {
|
1231 |
+
obj = this.get_node(obj);
|
1232 |
+
if(!obj || obj.id === $.jstree.root) {
|
1233 |
+
return false;
|
1234 |
+
}
|
1235 |
+
return obj.parent;
|
1236 |
+
},
|
1237 |
+
/**
|
1238 |
+
* get a jQuery collection of all the children of a node (node must be rendered), returns false on error
|
1239 |
+
* @name get_children_dom(obj)
|
1240 |
+
* @param {mixed} obj
|
1241 |
+
* @return {jQuery}
|
1242 |
+
*/
|
1243 |
+
get_children_dom : function (obj) {
|
1244 |
+
obj = this.get_node(obj, true);
|
1245 |
+
if(obj[0] === this.element[0]) {
|
1246 |
+
return this.get_container_ul().children(".jstree-node");
|
1247 |
+
}
|
1248 |
+
if(!obj || !obj.length) {
|
1249 |
+
return false;
|
1250 |
+
}
|
1251 |
+
return obj.children(".jstree-children").children(".jstree-node");
|
1252 |
+
},
|
1253 |
+
/**
|
1254 |
+
* checks if a node has children
|
1255 |
+
* @name is_parent(obj)
|
1256 |
+
* @param {mixed} obj
|
1257 |
+
* @return {Boolean}
|
1258 |
+
*/
|
1259 |
+
is_parent : function (obj) {
|
1260 |
+
obj = this.get_node(obj);
|
1261 |
+
return obj && (obj.state.loaded === false || obj.children.length > 0);
|
1262 |
+
},
|
1263 |
+
/**
|
1264 |
+
* checks if a node is loaded (its children are available)
|
1265 |
+
* @name is_loaded(obj)
|
1266 |
+
* @param {mixed} obj
|
1267 |
+
* @return {Boolean}
|
1268 |
+
*/
|
1269 |
+
is_loaded : function (obj) {
|
1270 |
+
obj = this.get_node(obj);
|
1271 |
+
return obj && obj.state.loaded;
|
1272 |
+
},
|
1273 |
+
/**
|
1274 |
+
* check if a node is currently loading (fetching children)
|
1275 |
+
* @name is_loading(obj)
|
1276 |
+
* @param {mixed} obj
|
1277 |
+
* @return {Boolean}
|
1278 |
+
*/
|
1279 |
+
is_loading : function (obj) {
|
1280 |
+
obj = this.get_node(obj);
|
1281 |
+
return obj && obj.state && obj.state.loading;
|
1282 |
+
},
|
1283 |
+
/**
|
1284 |
+
* check if a node is opened
|
1285 |
+
* @name is_open(obj)
|
1286 |
+
* @param {mixed} obj
|
1287 |
+
* @return {Boolean}
|
1288 |
+
*/
|
1289 |
+
is_open : function (obj) {
|
1290 |
+
obj = this.get_node(obj);
|
1291 |
+
return obj && obj.state.opened;
|
1292 |
+
},
|
1293 |
+
/**
|
1294 |
+
* check if a node is in a closed state
|
1295 |
+
* @name is_closed(obj)
|
1296 |
+
* @param {mixed} obj
|
1297 |
+
* @return {Boolean}
|
1298 |
+
*/
|
1299 |
+
is_closed : function (obj) {
|
1300 |
+
obj = this.get_node(obj);
|
1301 |
+
return obj && this.is_parent(obj) && !obj.state.opened;
|
1302 |
+
},
|
1303 |
+
/**
|
1304 |
+
* check if a node has no children
|
1305 |
+
* @name is_leaf(obj)
|
1306 |
+
* @param {mixed} obj
|
1307 |
+
* @return {Boolean}
|
1308 |
+
*/
|
1309 |
+
is_leaf : function (obj) {
|
1310 |
+
return !this.is_parent(obj);
|
1311 |
+
},
|
1312 |
+
/**
|
1313 |
+
* loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array.
|
1314 |
+
* @name load_node(obj [, callback])
|
1315 |
+
* @param {mixed} obj
|
1316 |
+
* @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives two arguments - the node and a boolean status
|
1317 |
+
* @return {Boolean}
|
1318 |
+
* @trigger load_node.jstree
|
1319 |
+
*/
|
1320 |
+
load_node : function (obj, callback) {
|
1321 |
+
var k, l, i, j, c;
|
1322 |
+
if($.isArray(obj)) {
|
1323 |
+
this._load_nodes(obj.slice(), callback);
|
1324 |
+
return true;
|
1325 |
+
}
|
1326 |
+
obj = this.get_node(obj);
|
1327 |
+
if(!obj) {
|
1328 |
+
if(callback) { callback.call(this, obj, false); }
|
1329 |
+
return false;
|
1330 |
+
}
|
1331 |
+
// if(obj.state.loading) { } // the node is already loading - just wait for it to load and invoke callback? but if called implicitly it should be loaded again?
|
1332 |
+
if(obj.state.loaded) {
|
1333 |
+
obj.state.loaded = false;
|
1334 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
1335 |
+
this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) {
|
1336 |
+
return $.inArray(v, obj.children_d) === -1;
|
1337 |
+
});
|
1338 |
+
}
|
1339 |
+
for(k = 0, l = obj.children_d.length; k < l; k++) {
|
1340 |
+
if(this._model.data[obj.children_d[k]].state.selected) {
|
1341 |
+
c = true;
|
1342 |
+
}
|
1343 |
+
delete this._model.data[obj.children_d[k]];
|
1344 |
+
}
|
1345 |
+
if (c) {
|
1346 |
+
this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) {
|
1347 |
+
return $.inArray(v, obj.children_d) === -1;
|
1348 |
+
});
|
1349 |
+
}
|
1350 |
+
obj.children = [];
|
1351 |
+
obj.children_d = [];
|
1352 |
+
if(c) {
|
1353 |
+
this.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selected });
|
1354 |
+
}
|
1355 |
+
}
|
1356 |
+
obj.state.failed = false;
|
1357 |
+
obj.state.loading = true;
|
1358 |
+
this.get_node(obj, true).addClass("jstree-loading").attr('aria-busy',true);
|
1359 |
+
this._load_node(obj, $.proxy(function (status) {
|
1360 |
+
obj = this._model.data[obj.id];
|
1361 |
+
obj.state.loading = false;
|
1362 |
+
obj.state.loaded = status;
|
1363 |
+
obj.state.failed = !obj.state.loaded;
|
1364 |
+
var dom = this.get_node(obj, true), i = 0, j = 0, m = this._model.data, has_children = false;
|
1365 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
1366 |
+
if(m[obj.children[i]] && !m[obj.children[i]].state.hidden) {
|
1367 |
+
has_children = true;
|
1368 |
+
break;
|
1369 |
+
}
|
1370 |
+
}
|
1371 |
+
if(obj.state.loaded && dom && dom.length) {
|
1372 |
+
dom.removeClass('jstree-closed jstree-open jstree-leaf');
|
1373 |
+
if (!has_children) {
|
1374 |
+
dom.addClass('jstree-leaf');
|
1375 |
+
}
|
1376 |
+
else {
|
1377 |
+
if (obj.id !== '#') {
|
1378 |
+
dom.addClass(obj.state.opened ? 'jstree-open' : 'jstree-closed');
|
1379 |
+
}
|
1380 |
+
}
|
1381 |
+
}
|
1382 |
+
dom.removeClass("jstree-loading").attr('aria-busy',false);
|
1383 |
+
/**
|
1384 |
+
* triggered after a node is loaded
|
1385 |
+
* @event
|
1386 |
+
* @name load_node.jstree
|
1387 |
+
* @param {Object} node the node that was loading
|
1388 |
+
* @param {Boolean} status was the node loaded successfully
|
1389 |
+
*/
|
1390 |
+
this.trigger('load_node', { "node" : obj, "status" : status });
|
1391 |
+
if(callback) {
|
1392 |
+
callback.call(this, obj, status);
|
1393 |
+
}
|
1394 |
+
}, this));
|
1395 |
+
return true;
|
1396 |
+
},
|
1397 |
+
/**
|
1398 |
+
* load an array of nodes (will also load unavailable nodes as soon as they appear in the structure). Used internally.
|
1399 |
+
* @private
|
1400 |
+
* @name _load_nodes(nodes [, callback])
|
1401 |
+
* @param {array} nodes
|
1402 |
+
* @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes
|
1403 |
+
*/
|
1404 |
+
_load_nodes : function (nodes, callback, is_callback, force_reload) {
|
1405 |
+
var r = true,
|
1406 |
+
c = function () { this._load_nodes(nodes, callback, true); },
|
1407 |
+
m = this._model.data, i, j, tmp = [];
|
1408 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
1409 |
+
if(m[nodes[i]] && ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || (!is_callback && force_reload) )) {
|
1410 |
+
if(!this.is_loading(nodes[i])) {
|
1411 |
+
this.load_node(nodes[i], c);
|
1412 |
+
}
|
1413 |
+
r = false;
|
1414 |
+
}
|
1415 |
+
}
|
1416 |
+
if(r) {
|
1417 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
1418 |
+
if(m[nodes[i]] && m[nodes[i]].state.loaded) {
|
1419 |
+
tmp.push(nodes[i]);
|
1420 |
+
}
|
1421 |
+
}
|
1422 |
+
if(callback && !callback.done) {
|
1423 |
+
callback.call(this, tmp);
|
1424 |
+
callback.done = true;
|
1425 |
+
}
|
1426 |
+
}
|
1427 |
+
},
|
1428 |
+
/**
|
1429 |
+
* loads all unloaded nodes
|
1430 |
+
* @name load_all([obj, callback])
|
1431 |
+
* @param {mixed} obj the node to load recursively, omit to load all nodes in the tree
|
1432 |
+
* @param {function} callback a function to be executed once loading all the nodes is complete,
|
1433 |
+
* @trigger load_all.jstree
|
1434 |
+
*/
|
1435 |
+
load_all : function (obj, callback) {
|
1436 |
+
if(!obj) { obj = $.jstree.root; }
|
1437 |
+
obj = this.get_node(obj);
|
1438 |
+
if(!obj) { return false; }
|
1439 |
+
var to_load = [],
|
1440 |
+
m = this._model.data,
|
1441 |
+
c = m[obj.id].children_d,
|
1442 |
+
i, j;
|
1443 |
+
if(obj.state && !obj.state.loaded) {
|
1444 |
+
to_load.push(obj.id);
|
1445 |
+
}
|
1446 |
+
for(i = 0, j = c.length; i < j; i++) {
|
1447 |
+
if(m[c[i]] && m[c[i]].state && !m[c[i]].state.loaded) {
|
1448 |
+
to_load.push(c[i]);
|
1449 |
+
}
|
1450 |
+
}
|
1451 |
+
if(to_load.length) {
|
1452 |
+
this._load_nodes(to_load, function () {
|
1453 |
+
this.load_all(obj, callback);
|
1454 |
+
});
|
1455 |
+
}
|
1456 |
+
else {
|
1457 |
+
/**
|
1458 |
+
* triggered after a load_all call completes
|
1459 |
+
* @event
|
1460 |
+
* @name load_all.jstree
|
1461 |
+
* @param {Object} node the recursively loaded node
|
1462 |
+
*/
|
1463 |
+
if(callback) { callback.call(this, obj); }
|
1464 |
+
this.trigger('load_all', { "node" : obj });
|
1465 |
+
}
|
1466 |
+
},
|
1467 |
+
/**
|
1468 |
+
* handles the actual loading of a node. Used only internally.
|
1469 |
+
* @private
|
1470 |
+
* @name _load_node(obj [, callback])
|
1471 |
+
* @param {mixed} obj
|
1472 |
+
* @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status
|
1473 |
+
* @return {Boolean}
|
1474 |
+
*/
|
1475 |
+
_load_node : function (obj, callback) {
|
1476 |
+
var s = this.settings.core.data, t;
|
1477 |
+
var notTextOrCommentNode = function notTextOrCommentNode () {
|
1478 |
+
return this.nodeType !== 3 && this.nodeType !== 8;
|
1479 |
+
};
|
1480 |
+
// use original HTML
|
1481 |
+
if(!s) {
|
1482 |
+
if(obj.id === $.jstree.root) {
|
1483 |
+
return this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (status) {
|
1484 |
+
callback.call(this, status);
|
1485 |
+
});
|
1486 |
+
}
|
1487 |
+
else {
|
1488 |
+
return callback.call(this, false);
|
1489 |
+
}
|
1490 |
+
// return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false);
|
1491 |
+
}
|
1492 |
+
if($.isFunction(s)) {
|
1493 |
+
return s.call(this, obj, $.proxy(function (d) {
|
1494 |
+
if(d === false) {
|
1495 |
+
callback.call(this, false);
|
1496 |
+
}
|
1497 |
+
else {
|
1498 |
+
this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $($.parseHTML(d)).filter(notTextOrCommentNode) : d, function (status) {
|
1499 |
+
callback.call(this, status);
|
1500 |
+
});
|
1501 |
+
}
|
1502 |
+
// return d === false ? callback.call(this, false) : callback.call(this, this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $(d) : d));
|
1503 |
+
}, this));
|
1504 |
+
}
|
1505 |
+
if(typeof s === 'object') {
|
1506 |
+
if(s.url) {
|
1507 |
+
s = $.extend(true, {}, s);
|
1508 |
+
if($.isFunction(s.url)) {
|
1509 |
+
s.url = s.url.call(this, obj);
|
1510 |
+
}
|
1511 |
+
if($.isFunction(s.data)) {
|
1512 |
+
s.data = s.data.call(this, obj);
|
1513 |
+
}
|
1514 |
+
return $.ajax(s)
|
1515 |
+
.done($.proxy(function (d,t,x) {
|
1516 |
+
var type = x.getResponseHeader('Content-Type');
|
1517 |
+
if((type && type.indexOf('json') !== -1) || typeof d === "object") {
|
1518 |
+
return this._append_json_data(obj, d, function (status) { callback.call(this, status); });
|
1519 |
+
//return callback.call(this, this._append_json_data(obj, d));
|
1520 |
+
}
|
1521 |
+
if((type && type.indexOf('html') !== -1) || typeof d === "string") {
|
1522 |
+
return this._append_html_data(obj, $($.parseHTML(d)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); });
|
1523 |
+
// return callback.call(this, this._append_html_data(obj, $(d)));
|
1524 |
+
}
|
1525 |
+
this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) };
|
1526 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
1527 |
+
return callback.call(this, false);
|
1528 |
+
}, this))
|
1529 |
+
.fail($.proxy(function (f) {
|
1530 |
+
this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) };
|
1531 |
+
callback.call(this, false);
|
1532 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
1533 |
+
}, this));
|
1534 |
+
}
|
1535 |
+
if ($.isArray(s)) {
|
1536 |
+
t = $.extend(true, [], s);
|
1537 |
+
} else if ($.isPlainObject(s)) {
|
1538 |
+
t = $.extend(true, {}, s);
|
1539 |
+
} else {
|
1540 |
+
t = s;
|
1541 |
+
}
|
1542 |
+
if(obj.id === $.jstree.root) {
|
1543 |
+
return this._append_json_data(obj, t, function (status) {
|
1544 |
+
callback.call(this, status);
|
1545 |
+
});
|
1546 |
+
}
|
1547 |
+
else {
|
1548 |
+
this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) };
|
1549 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
1550 |
+
return callback.call(this, false);
|
1551 |
+
}
|
1552 |
+
//return callback.call(this, (obj.id === $.jstree.root ? this._append_json_data(obj, t) : false) );
|
1553 |
+
}
|
1554 |
+
if(typeof s === 'string') {
|
1555 |
+
if(obj.id === $.jstree.root) {
|
1556 |
+
return this._append_html_data(obj, $($.parseHTML(s)).filter(notTextOrCommentNode), function (status) {
|
1557 |
+
callback.call(this, status);
|
1558 |
+
});
|
1559 |
+
}
|
1560 |
+
else {
|
1561 |
+
this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) };
|
1562 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
1563 |
+
return callback.call(this, false);
|
1564 |
+
}
|
1565 |
+
//return callback.call(this, (obj.id === $.jstree.root ? this._append_html_data(obj, $(s)) : false) );
|
1566 |
+
}
|
1567 |
+
return callback.call(this, false);
|
1568 |
+
},
|
1569 |
+
/**
|
1570 |
+
* adds a node to the list of nodes to redraw. Used only internally.
|
1571 |
+
* @private
|
1572 |
+
* @name _node_changed(obj [, callback])
|
1573 |
+
* @param {mixed} obj
|
1574 |
+
*/
|
1575 |
+
_node_changed : function (obj) {
|
1576 |
+
obj = this.get_node(obj);
|
1577 |
+
if (obj && $.inArray(obj.id, this._model.changed) === -1) {
|
1578 |
+
this._model.changed.push(obj.id);
|
1579 |
+
}
|
1580 |
+
},
|
1581 |
+
/**
|
1582 |
+
* appends HTML content to the tree. Used internally.
|
1583 |
+
* @private
|
1584 |
+
* @name _append_html_data(obj, data)
|
1585 |
+
* @param {mixed} obj the node to append to
|
1586 |
+
* @param {String} data the HTML string to parse and append
|
1587 |
+
* @trigger model.jstree, changed.jstree
|
1588 |
+
*/
|
1589 |
+
_append_html_data : function (dom, data, cb) {
|
1590 |
+
dom = this.get_node(dom);
|
1591 |
+
dom.children = [];
|
1592 |
+
dom.children_d = [];
|
1593 |
+
var dat = data.is('ul') ? data.children() : data,
|
1594 |
+
par = dom.id,
|
1595 |
+
chd = [],
|
1596 |
+
dpc = [],
|
1597 |
+
m = this._model.data,
|
1598 |
+
p = m[par],
|
1599 |
+
s = this._data.core.selected.length,
|
1600 |
+
tmp, i, j;
|
1601 |
+
dat.each($.proxy(function (i, v) {
|
1602 |
+
tmp = this._parse_model_from_html($(v), par, p.parents.concat());
|
1603 |
+
if(tmp) {
|
1604 |
+
chd.push(tmp);
|
1605 |
+
dpc.push(tmp);
|
1606 |
+
if(m[tmp].children_d.length) {
|
1607 |
+
dpc = dpc.concat(m[tmp].children_d);
|
1608 |
+
}
|
1609 |
+
}
|
1610 |
+
}, this));
|
1611 |
+
p.children = chd;
|
1612 |
+
p.children_d = dpc;
|
1613 |
+
for(i = 0, j = p.parents.length; i < j; i++) {
|
1614 |
+
m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc);
|
1615 |
+
}
|
1616 |
+
/**
|
1617 |
+
* triggered when new data is inserted to the tree model
|
1618 |
+
* @event
|
1619 |
+
* @name model.jstree
|
1620 |
+
* @param {Array} nodes an array of node IDs
|
1621 |
+
* @param {String} parent the parent ID of the nodes
|
1622 |
+
*/
|
1623 |
+
this.trigger('model', { "nodes" : dpc, 'parent' : par });
|
1624 |
+
if(par !== $.jstree.root) {
|
1625 |
+
this._node_changed(par);
|
1626 |
+
this.redraw();
|
1627 |
+
}
|
1628 |
+
else {
|
1629 |
+
this.get_container_ul().children('.jstree-initial-node').remove();
|
1630 |
+
this.redraw(true);
|
1631 |
+
}
|
1632 |
+
if(this._data.core.selected.length !== s) {
|
1633 |
+
this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected });
|
1634 |
+
}
|
1635 |
+
cb.call(this, true);
|
1636 |
+
},
|
1637 |
+
/**
|
1638 |
+
* appends JSON content to the tree. Used internally.
|
1639 |
+
* @private
|
1640 |
+
* @name _append_json_data(obj, data)
|
1641 |
+
* @param {mixed} obj the node to append to
|
1642 |
+
* @param {String} data the JSON object to parse and append
|
1643 |
+
* @param {Boolean} force_processing internal param - do not set
|
1644 |
+
* @trigger model.jstree, changed.jstree
|
1645 |
+
*/
|
1646 |
+
_append_json_data : function (dom, data, cb, force_processing) {
|
1647 |
+
if(this.element === null) { return; }
|
1648 |
+
dom = this.get_node(dom);
|
1649 |
+
dom.children = [];
|
1650 |
+
dom.children_d = [];
|
1651 |
+
// *%$@!!!
|
1652 |
+
if(data.d) {
|
1653 |
+
data = data.d;
|
1654 |
+
if(typeof data === "string") {
|
1655 |
+
data = JSON.parse(data);
|
1656 |
+
}
|
1657 |
+
}
|
1658 |
+
if(!$.isArray(data)) { data = [data]; }
|
1659 |
+
var w = null,
|
1660 |
+
args = {
|
1661 |
+
'df' : this._model.default_state,
|
1662 |
+
'dat' : data,
|
1663 |
+
'par' : dom.id,
|
1664 |
+
'm' : this._model.data,
|
1665 |
+
't_id' : this._id,
|
1666 |
+
't_cnt' : this._cnt,
|
1667 |
+
'sel' : this._data.core.selected
|
1668 |
+
},
|
1669 |
+
inst = this,
|
1670 |
+
func = function (data, undefined) {
|
1671 |
+
if(data.data) { data = data.data; }
|
1672 |
+
var dat = data.dat,
|
1673 |
+
par = data.par,
|
1674 |
+
chd = [],
|
1675 |
+
dpc = [],
|
1676 |
+
add = [],
|
1677 |
+
df = data.df,
|
1678 |
+
t_id = data.t_id,
|
1679 |
+
t_cnt = data.t_cnt,
|
1680 |
+
m = data.m,
|
1681 |
+
p = m[par],
|
1682 |
+
sel = data.sel,
|
1683 |
+
tmp, i, j, rslt,
|
1684 |
+
parse_flat = function (d, p, ps) {
|
1685 |
+
if(!ps) { ps = []; }
|
1686 |
+
else { ps = ps.concat(); }
|
1687 |
+
if(p) { ps.unshift(p); }
|
1688 |
+
var tid = d.id.toString(),
|
1689 |
+
i, j, c, e,
|
1690 |
+
tmp = {
|
1691 |
+
id : tid,
|
1692 |
+
text : d.text || '',
|
1693 |
+
icon : d.icon !== undefined ? d.icon : true,
|
1694 |
+
parent : p,
|
1695 |
+
parents : ps,
|
1696 |
+
children : d.children || [],
|
1697 |
+
children_d : d.children_d || [],
|
1698 |
+
data : d.data,
|
1699 |
+
state : { },
|
1700 |
+
li_attr : { id : false },
|
1701 |
+
a_attr : { href : '#' },
|
1702 |
+
original : false
|
1703 |
+
};
|
1704 |
+
for(i in df) {
|
1705 |
+
if(df.hasOwnProperty(i)) {
|
1706 |
+
tmp.state[i] = df[i];
|
1707 |
+
}
|
1708 |
+
}
|
1709 |
+
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
|
1710 |
+
tmp.icon = d.data.jstree.icon;
|
1711 |
+
}
|
1712 |
+
if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") {
|
1713 |
+
tmp.icon = true;
|
1714 |
+
}
|
1715 |
+
if(d && d.data) {
|
1716 |
+
tmp.data = d.data;
|
1717 |
+
if(d.data.jstree) {
|
1718 |
+
for(i in d.data.jstree) {
|
1719 |
+
if(d.data.jstree.hasOwnProperty(i)) {
|
1720 |
+
tmp.state[i] = d.data.jstree[i];
|
1721 |
+
}
|
1722 |
+
}
|
1723 |
+
}
|
1724 |
+
}
|
1725 |
+
if(d && typeof d.state === 'object') {
|
1726 |
+
for (i in d.state) {
|
1727 |
+
if(d.state.hasOwnProperty(i)) {
|
1728 |
+
tmp.state[i] = d.state[i];
|
1729 |
+
}
|
1730 |
+
}
|
1731 |
+
}
|
1732 |
+
if(d && typeof d.li_attr === 'object') {
|
1733 |
+
for (i in d.li_attr) {
|
1734 |
+
if(d.li_attr.hasOwnProperty(i)) {
|
1735 |
+
tmp.li_attr[i] = d.li_attr[i];
|
1736 |
+
}
|
1737 |
+
}
|
1738 |
+
}
|
1739 |
+
if(!tmp.li_attr.id) {
|
1740 |
+
tmp.li_attr.id = tid;
|
1741 |
+
}
|
1742 |
+
if(d && typeof d.a_attr === 'object') {
|
1743 |
+
for (i in d.a_attr) {
|
1744 |
+
if(d.a_attr.hasOwnProperty(i)) {
|
1745 |
+
tmp.a_attr[i] = d.a_attr[i];
|
1746 |
+
}
|
1747 |
+
}
|
1748 |
+
}
|
1749 |
+
if(d && d.children && d.children === true) {
|
1750 |
+
tmp.state.loaded = false;
|
1751 |
+
tmp.children = [];
|
1752 |
+
tmp.children_d = [];
|
1753 |
+
}
|
1754 |
+
m[tmp.id] = tmp;
|
1755 |
+
for(i = 0, j = tmp.children.length; i < j; i++) {
|
1756 |
+
c = parse_flat(m[tmp.children[i]], tmp.id, ps);
|
1757 |
+
e = m[c];
|
1758 |
+
tmp.children_d.push(c);
|
1759 |
+
if(e.children_d.length) {
|
1760 |
+
tmp.children_d = tmp.children_d.concat(e.children_d);
|
1761 |
+
}
|
1762 |
+
}
|
1763 |
+
delete d.data;
|
1764 |
+
delete d.children;
|
1765 |
+
m[tmp.id].original = d;
|
1766 |
+
if(tmp.state.selected) {
|
1767 |
+
add.push(tmp.id);
|
1768 |
+
}
|
1769 |
+
return tmp.id;
|
1770 |
+
},
|
1771 |
+
parse_nest = function (d, p, ps) {
|
1772 |
+
if(!ps) { ps = []; }
|
1773 |
+
else { ps = ps.concat(); }
|
1774 |
+
if(p) { ps.unshift(p); }
|
1775 |
+
var tid = false, i, j, c, e, tmp;
|
1776 |
+
do {
|
1777 |
+
tid = 'j' + t_id + '_' + (++t_cnt);
|
1778 |
+
} while(m[tid]);
|
1779 |
+
|
1780 |
+
tmp = {
|
1781 |
+
id : false,
|
1782 |
+
text : typeof d === 'string' ? d : '',
|
1783 |
+
icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true,
|
1784 |
+
parent : p,
|
1785 |
+
parents : ps,
|
1786 |
+
children : [],
|
1787 |
+
children_d : [],
|
1788 |
+
data : null,
|
1789 |
+
state : { },
|
1790 |
+
li_attr : { id : false },
|
1791 |
+
a_attr : { href : '#' },
|
1792 |
+
original : false
|
1793 |
+
};
|
1794 |
+
for(i in df) {
|
1795 |
+
if(df.hasOwnProperty(i)) {
|
1796 |
+
tmp.state[i] = df[i];
|
1797 |
+
}
|
1798 |
+
}
|
1799 |
+
if(d && d.id) { tmp.id = d.id.toString(); }
|
1800 |
+
if(d && d.text) { tmp.text = d.text; }
|
1801 |
+
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
|
1802 |
+
tmp.icon = d.data.jstree.icon;
|
1803 |
+
}
|
1804 |
+
if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") {
|
1805 |
+
tmp.icon = true;
|
1806 |
+
}
|
1807 |
+
if(d && d.data) {
|
1808 |
+
tmp.data = d.data;
|
1809 |
+
if(d.data.jstree) {
|
1810 |
+
for(i in d.data.jstree) {
|
1811 |
+
if(d.data.jstree.hasOwnProperty(i)) {
|
1812 |
+
tmp.state[i] = d.data.jstree[i];
|
1813 |
+
}
|
1814 |
+
}
|
1815 |
+
}
|
1816 |
+
}
|
1817 |
+
if(d && typeof d.state === 'object') {
|
1818 |
+
for (i in d.state) {
|
1819 |
+
if(d.state.hasOwnProperty(i)) {
|
1820 |
+
tmp.state[i] = d.state[i];
|
1821 |
+
}
|
1822 |
+
}
|
1823 |
+
}
|
1824 |
+
if(d && typeof d.li_attr === 'object') {
|
1825 |
+
for (i in d.li_attr) {
|
1826 |
+
if(d.li_attr.hasOwnProperty(i)) {
|
1827 |
+
tmp.li_attr[i] = d.li_attr[i];
|
1828 |
+
}
|
1829 |
+
}
|
1830 |
+
}
|
1831 |
+
if(tmp.li_attr.id && !tmp.id) {
|
1832 |
+
tmp.id = tmp.li_attr.id.toString();
|
1833 |
+
}
|
1834 |
+
if(!tmp.id) {
|
1835 |
+
tmp.id = tid;
|
1836 |
+
}
|
1837 |
+
if(!tmp.li_attr.id) {
|
1838 |
+
tmp.li_attr.id = tmp.id;
|
1839 |
+
}
|
1840 |
+
if(d && typeof d.a_attr === 'object') {
|
1841 |
+
for (i in d.a_attr) {
|
1842 |
+
if(d.a_attr.hasOwnProperty(i)) {
|
1843 |
+
tmp.a_attr[i] = d.a_attr[i];
|
1844 |
+
}
|
1845 |
+
}
|
1846 |
+
}
|
1847 |
+
if(d && d.children && d.children.length) {
|
1848 |
+
for(i = 0, j = d.children.length; i < j; i++) {
|
1849 |
+
c = parse_nest(d.children[i], tmp.id, ps);
|
1850 |
+
e = m[c];
|
1851 |
+
tmp.children.push(c);
|
1852 |
+
if(e.children_d.length) {
|
1853 |
+
tmp.children_d = tmp.children_d.concat(e.children_d);
|
1854 |
+
}
|
1855 |
+
}
|
1856 |
+
tmp.children_d = tmp.children_d.concat(tmp.children);
|
1857 |
+
}
|
1858 |
+
if(d && d.children && d.children === true) {
|
1859 |
+
tmp.state.loaded = false;
|
1860 |
+
tmp.children = [];
|
1861 |
+
tmp.children_d = [];
|
1862 |
+
}
|
1863 |
+
delete d.data;
|
1864 |
+
delete d.children;
|
1865 |
+
tmp.original = d;
|
1866 |
+
m[tmp.id] = tmp;
|
1867 |
+
if(tmp.state.selected) {
|
1868 |
+
add.push(tmp.id);
|
1869 |
+
}
|
1870 |
+
return tmp.id;
|
1871 |
+
};
|
1872 |
+
|
1873 |
+
if(dat.length && dat[0].id !== undefined && dat[0].parent !== undefined) {
|
1874 |
+
// Flat JSON support (for easy import from DB):
|
1875 |
+
// 1) convert to object (foreach)
|
1876 |
+
for(i = 0, j = dat.length; i < j; i++) {
|
1877 |
+
if(!dat[i].children) {
|
1878 |
+
dat[i].children = [];
|
1879 |
+
}
|
1880 |
+
if(!dat[i].state) {
|
1881 |
+
dat[i].state = {};
|
1882 |
+
}
|
1883 |
+
m[dat[i].id.toString()] = dat[i];
|
1884 |
+
}
|
1885 |
+
// 2) populate children (foreach)
|
1886 |
+
for(i = 0, j = dat.length; i < j; i++) {
|
1887 |
+
if (!m[dat[i].parent.toString()]) {
|
1888 |
+
if (typeof inst !== "undefined") {
|
1889 |
+
inst._data.core.last_error = { 'error' : 'parse', 'plugin' : 'core', 'id' : 'core_07', 'reason' : 'Node with invalid parent', 'data' : JSON.stringify({ 'id' : dat[i].id.toString(), 'parent' : dat[i].parent.toString() }) };
|
1890 |
+
inst.settings.core.error.call(inst, inst._data.core.last_error);
|
1891 |
+
}
|
1892 |
+
continue;
|
1893 |
+
}
|
1894 |
+
|
1895 |
+
m[dat[i].parent.toString()].children.push(dat[i].id.toString());
|
1896 |
+
// populate parent.children_d
|
1897 |
+
p.children_d.push(dat[i].id.toString());
|
1898 |
+
}
|
1899 |
+
// 3) normalize && populate parents and children_d with recursion
|
1900 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
1901 |
+
tmp = parse_flat(m[p.children[i]], par, p.parents.concat());
|
1902 |
+
dpc.push(tmp);
|
1903 |
+
if(m[tmp].children_d.length) {
|
1904 |
+
dpc = dpc.concat(m[tmp].children_d);
|
1905 |
+
}
|
1906 |
+
}
|
1907 |
+
for(i = 0, j = p.parents.length; i < j; i++) {
|
1908 |
+
m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc);
|
1909 |
+
}
|
1910 |
+
// ?) three_state selection - p.state.selected && t - (if three_state foreach(dat => ch) -> foreach(parents) if(parent.selected) child.selected = true;
|
1911 |
+
rslt = {
|
1912 |
+
'cnt' : t_cnt,
|
1913 |
+
'mod' : m,
|
1914 |
+
'sel' : sel,
|
1915 |
+
'par' : par,
|
1916 |
+
'dpc' : dpc,
|
1917 |
+
'add' : add
|
1918 |
+
};
|
1919 |
+
}
|
1920 |
+
else {
|
1921 |
+
for(i = 0, j = dat.length; i < j; i++) {
|
1922 |
+
tmp = parse_nest(dat[i], par, p.parents.concat());
|
1923 |
+
if(tmp) {
|
1924 |
+
chd.push(tmp);
|
1925 |
+
dpc.push(tmp);
|
1926 |
+
if(m[tmp].children_d.length) {
|
1927 |
+
dpc = dpc.concat(m[tmp].children_d);
|
1928 |
+
}
|
1929 |
+
}
|
1930 |
+
}
|
1931 |
+
p.children = chd;
|
1932 |
+
p.children_d = dpc;
|
1933 |
+
for(i = 0, j = p.parents.length; i < j; i++) {
|
1934 |
+
m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc);
|
1935 |
+
}
|
1936 |
+
rslt = {
|
1937 |
+
'cnt' : t_cnt,
|
1938 |
+
'mod' : m,
|
1939 |
+
'sel' : sel,
|
1940 |
+
'par' : par,
|
1941 |
+
'dpc' : dpc,
|
1942 |
+
'add' : add
|
1943 |
+
};
|
1944 |
+
}
|
1945 |
+
if(typeof window === 'undefined' || typeof window.document === 'undefined') {
|
1946 |
+
postMessage(rslt);
|
1947 |
+
}
|
1948 |
+
else {
|
1949 |
+
return rslt;
|
1950 |
+
}
|
1951 |
+
},
|
1952 |
+
rslt = function (rslt, worker) {
|
1953 |
+
if(this.element === null) { return; }
|
1954 |
+
this._cnt = rslt.cnt;
|
1955 |
+
var i, m = this._model.data;
|
1956 |
+
for (i in m) {
|
1957 |
+
if (m.hasOwnProperty(i) && m[i].state && m[i].state.loading && rslt.mod[i]) {
|
1958 |
+
rslt.mod[i].state.loading = true;
|
1959 |
+
}
|
1960 |
+
}
|
1961 |
+
this._model.data = rslt.mod; // breaks the reference in load_node - careful
|
1962 |
+
|
1963 |
+
if(worker) {
|
1964 |
+
var j, a = rslt.add, r = rslt.sel, s = this._data.core.selected.slice();
|
1965 |
+
m = this._model.data;
|
1966 |
+
// if selection was changed while calculating in worker
|
1967 |
+
if(r.length !== s.length || $.vakata.array_unique(r.concat(s)).length !== r.length) {
|
1968 |
+
// deselect nodes that are no longer selected
|
1969 |
+
for(i = 0, j = r.length; i < j; i++) {
|
1970 |
+
if($.inArray(r[i], a) === -1 && $.inArray(r[i], s) === -1) {
|
1971 |
+
m[r[i]].state.selected = false;
|
1972 |
+
}
|
1973 |
+
}
|
1974 |
+
// select nodes that were selected in the mean time
|
1975 |
+
for(i = 0, j = s.length; i < j; i++) {
|
1976 |
+
if($.inArray(s[i], r) === -1) {
|
1977 |
+
m[s[i]].state.selected = true;
|
1978 |
+
}
|
1979 |
+
}
|
1980 |
+
}
|
1981 |
+
}
|
1982 |
+
if(rslt.add.length) {
|
1983 |
+
this._data.core.selected = this._data.core.selected.concat(rslt.add);
|
1984 |
+
}
|
1985 |
+
|
1986 |
+
this.trigger('model', { "nodes" : rslt.dpc, 'parent' : rslt.par });
|
1987 |
+
|
1988 |
+
if(rslt.par !== $.jstree.root) {
|
1989 |
+
this._node_changed(rslt.par);
|
1990 |
+
this.redraw();
|
1991 |
+
}
|
1992 |
+
else {
|
1993 |
+
// this.get_container_ul().children('.jstree-initial-node').remove();
|
1994 |
+
this.redraw(true);
|
1995 |
+
}
|
1996 |
+
if(rslt.add.length) {
|
1997 |
+
this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected });
|
1998 |
+
}
|
1999 |
+
|
2000 |
+
// If no worker, try to mimic worker behavioour, by invoking cb asynchronously
|
2001 |
+
if (!worker && setImmediate) {
|
2002 |
+
setImmediate(function(){
|
2003 |
+
cb.call(inst, true);
|
2004 |
+
});
|
2005 |
+
}
|
2006 |
+
else {
|
2007 |
+
cb.call(inst, true);
|
2008 |
+
}
|
2009 |
+
};
|
2010 |
+
if(this.settings.core.worker && window.Blob && window.URL && window.Worker) {
|
2011 |
+
try {
|
2012 |
+
if(this._wrk === null) {
|
2013 |
+
this._wrk = window.URL.createObjectURL(
|
2014 |
+
new window.Blob(
|
2015 |
+
['self.onmessage = ' + func.toString()],
|
2016 |
+
{type:"text/javascript"}
|
2017 |
+
)
|
2018 |
+
);
|
2019 |
+
}
|
2020 |
+
if(!this._data.core.working || force_processing) {
|
2021 |
+
this._data.core.working = true;
|
2022 |
+
w = new window.Worker(this._wrk);
|
2023 |
+
w.onmessage = $.proxy(function (e) {
|
2024 |
+
rslt.call(this, e.data, true);
|
2025 |
+
try { w.terminate(); w = null; } catch(ignore) { }
|
2026 |
+
if(this._data.core.worker_queue.length) {
|
2027 |
+
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
|
2028 |
+
}
|
2029 |
+
else {
|
2030 |
+
this._data.core.working = false;
|
2031 |
+
}
|
2032 |
+
}, this);
|
2033 |
+
if(!args.par) {
|
2034 |
+
if(this._data.core.worker_queue.length) {
|
2035 |
+
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
|
2036 |
+
}
|
2037 |
+
else {
|
2038 |
+
this._data.core.working = false;
|
2039 |
+
}
|
2040 |
+
}
|
2041 |
+
else {
|
2042 |
+
w.postMessage(args);
|
2043 |
+
}
|
2044 |
+
}
|
2045 |
+
else {
|
2046 |
+
this._data.core.worker_queue.push([dom, data, cb, true]);
|
2047 |
+
}
|
2048 |
+
}
|
2049 |
+
catch(e) {
|
2050 |
+
rslt.call(this, func(args), false);
|
2051 |
+
if(this._data.core.worker_queue.length) {
|
2052 |
+
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
|
2053 |
+
}
|
2054 |
+
else {
|
2055 |
+
this._data.core.working = false;
|
2056 |
+
}
|
2057 |
+
}
|
2058 |
+
}
|
2059 |
+
else {
|
2060 |
+
rslt.call(this, func(args), false);
|
2061 |
+
}
|
2062 |
+
},
|
2063 |
+
/**
|
2064 |
+
* parses a node from a jQuery object and appends them to the in memory tree model. Used internally.
|
2065 |
+
* @private
|
2066 |
+
* @name _parse_model_from_html(d [, p, ps])
|
2067 |
+
* @param {jQuery} d the jQuery object to parse
|
2068 |
+
* @param {String} p the parent ID
|
2069 |
+
* @param {Array} ps list of all parents
|
2070 |
+
* @return {String} the ID of the object added to the model
|
2071 |
+
*/
|
2072 |
+
_parse_model_from_html : function (d, p, ps) {
|
2073 |
+
if(!ps) { ps = []; }
|
2074 |
+
else { ps = [].concat(ps); }
|
2075 |
+
if(p) { ps.unshift(p); }
|
2076 |
+
var c, e, m = this._model.data,
|
2077 |
+
data = {
|
2078 |
+
id : false,
|
2079 |
+
text : false,
|
2080 |
+
icon : true,
|
2081 |
+
parent : p,
|
2082 |
+
parents : ps,
|
2083 |
+
children : [],
|
2084 |
+
children_d : [],
|
2085 |
+
data : null,
|
2086 |
+
state : { },
|
2087 |
+
li_attr : { id : false },
|
2088 |
+
a_attr : { href : '#' },
|
2089 |
+
original : false
|
2090 |
+
}, i, tmp, tid;
|
2091 |
+
for(i in this._model.default_state) {
|
2092 |
+
if(this._model.default_state.hasOwnProperty(i)) {
|
2093 |
+
data.state[i] = this._model.default_state[i];
|
2094 |
+
}
|
2095 |
+
}
|
2096 |
+
tmp = $.vakata.attributes(d, true);
|
2097 |
+
$.each(tmp, function (i, v) {
|
2098 |
+
v = $.trim(v);
|
2099 |
+
if(!v.length) { return true; }
|
2100 |
+
data.li_attr[i] = v;
|
2101 |
+
if(i === 'id') {
|
2102 |
+
data.id = v.toString();
|
2103 |
+
}
|
2104 |
+
});
|
2105 |
+
tmp = d.children('a').first();
|
2106 |
+
if(tmp.length) {
|
2107 |
+
tmp = $.vakata.attributes(tmp, true);
|
2108 |
+
$.each(tmp, function (i, v) {
|
2109 |
+
v = $.trim(v);
|
2110 |
+
if(v.length) {
|
2111 |
+
data.a_attr[i] = v;
|
2112 |
+
}
|
2113 |
+
});
|
2114 |
+
}
|
2115 |
+
tmp = d.children("a").first().length ? d.children("a").first().clone() : d.clone();
|
2116 |
+
tmp.children("ins, i, ul").remove();
|
2117 |
+
tmp = tmp.html();
|
2118 |
+
tmp = $('<div></div>').html(tmp);
|
2119 |
+
data.text = this.settings.core.force_text ? tmp.text() : tmp.html();
|
2120 |
+
tmp = d.data();
|
2121 |
+
data.data = tmp ? $.extend(true, {}, tmp) : null;
|
2122 |
+
data.state.opened = d.hasClass('jstree-open');
|
2123 |
+
data.state.selected = d.children('a').hasClass('jstree-clicked');
|
2124 |
+
data.state.disabled = d.children('a').hasClass('jstree-disabled');
|
2125 |
+
if(data.data && data.data.jstree) {
|
2126 |
+
for(i in data.data.jstree) {
|
2127 |
+
if(data.data.jstree.hasOwnProperty(i)) {
|
2128 |
+
data.state[i] = data.data.jstree[i];
|
2129 |
+
}
|
2130 |
+
}
|
2131 |
+
}
|
2132 |
+
tmp = d.children("a").children(".jstree-themeicon");
|
2133 |
+
if(tmp.length) {
|
2134 |
+
data.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel');
|
2135 |
+
}
|
2136 |
+
if(data.state.icon !== undefined) {
|
2137 |
+
data.icon = data.state.icon;
|
2138 |
+
}
|
2139 |
+
if(data.icon === undefined || data.icon === null || data.icon === "") {
|
2140 |
+
data.icon = true;
|
2141 |
+
}
|
2142 |
+
tmp = d.children("ul").children("li");
|
2143 |
+
do {
|
2144 |
+
tid = 'j' + this._id + '_' + (++this._cnt);
|
2145 |
+
} while(m[tid]);
|
2146 |
+
data.id = data.li_attr.id ? data.li_attr.id.toString() : tid;
|
2147 |
+
if(tmp.length) {
|
2148 |
+
tmp.each($.proxy(function (i, v) {
|
2149 |
+
c = this._parse_model_from_html($(v), data.id, ps);
|
2150 |
+
e = this._model.data[c];
|
2151 |
+
data.children.push(c);
|
2152 |
+
if(e.children_d.length) {
|
2153 |
+
data.children_d = data.children_d.concat(e.children_d);
|
2154 |
+
}
|
2155 |
+
}, this));
|
2156 |
+
data.children_d = data.children_d.concat(data.children);
|
2157 |
+
}
|
2158 |
+
else {
|
2159 |
+
if(d.hasClass('jstree-closed')) {
|
2160 |
+
data.state.loaded = false;
|
2161 |
+
}
|
2162 |
+
}
|
2163 |
+
if(data.li_attr['class']) {
|
2164 |
+
data.li_attr['class'] = data.li_attr['class'].replace('jstree-closed','').replace('jstree-open','');
|
2165 |
+
}
|
2166 |
+
if(data.a_attr['class']) {
|
2167 |
+
data.a_attr['class'] = data.a_attr['class'].replace('jstree-clicked','').replace('jstree-disabled','');
|
2168 |
+
}
|
2169 |
+
m[data.id] = data;
|
2170 |
+
if(data.state.selected) {
|
2171 |
+
this._data.core.selected.push(data.id);
|
2172 |
+
}
|
2173 |
+
return data.id;
|
2174 |
+
},
|
2175 |
+
/**
|
2176 |
+
* parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally.
|
2177 |
+
* @private
|
2178 |
+
* @name _parse_model_from_flat_json(d [, p, ps])
|
2179 |
+
* @param {Object} d the JSON object to parse
|
2180 |
+
* @param {String} p the parent ID
|
2181 |
+
* @param {Array} ps list of all parents
|
2182 |
+
* @return {String} the ID of the object added to the model
|
2183 |
+
*/
|
2184 |
+
_parse_model_from_flat_json : function (d, p, ps) {
|
2185 |
+
if(!ps) { ps = []; }
|
2186 |
+
else { ps = ps.concat(); }
|
2187 |
+
if(p) { ps.unshift(p); }
|
2188 |
+
var tid = d.id.toString(),
|
2189 |
+
m = this._model.data,
|
2190 |
+
df = this._model.default_state,
|
2191 |
+
i, j, c, e,
|
2192 |
+
tmp = {
|
2193 |
+
id : tid,
|
2194 |
+
text : d.text || '',
|
2195 |
+
icon : d.icon !== undefined ? d.icon : true,
|
2196 |
+
parent : p,
|
2197 |
+
parents : ps,
|
2198 |
+
children : d.children || [],
|
2199 |
+
children_d : d.children_d || [],
|
2200 |
+
data : d.data,
|
2201 |
+
state : { },
|
2202 |
+
li_attr : { id : false },
|
2203 |
+
a_attr : { href : '#' },
|
2204 |
+
original : false
|
2205 |
+
};
|
2206 |
+
for(i in df) {
|
2207 |
+
if(df.hasOwnProperty(i)) {
|
2208 |
+
tmp.state[i] = df[i];
|
2209 |
+
}
|
2210 |
+
}
|
2211 |
+
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
|
2212 |
+
tmp.icon = d.data.jstree.icon;
|
2213 |
+
}
|
2214 |
+
if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") {
|
2215 |
+
tmp.icon = true;
|
2216 |
+
}
|
2217 |
+
if(d && d.data) {
|
2218 |
+
tmp.data = d.data;
|
2219 |
+
if(d.data.jstree) {
|
2220 |
+
for(i in d.data.jstree) {
|
2221 |
+
if(d.data.jstree.hasOwnProperty(i)) {
|
2222 |
+
tmp.state[i] = d.data.jstree[i];
|
2223 |
+
}
|
2224 |
+
}
|
2225 |
+
}
|
2226 |
+
}
|
2227 |
+
if(d && typeof d.state === 'object') {
|
2228 |
+
for (i in d.state) {
|
2229 |
+
if(d.state.hasOwnProperty(i)) {
|
2230 |
+
tmp.state[i] = d.state[i];
|
2231 |
+
}
|
2232 |
+
}
|
2233 |
+
}
|
2234 |
+
if(d && typeof d.li_attr === 'object') {
|
2235 |
+
for (i in d.li_attr) {
|
2236 |
+
if(d.li_attr.hasOwnProperty(i)) {
|
2237 |
+
tmp.li_attr[i] = d.li_attr[i];
|
2238 |
+
}
|
2239 |
+
}
|
2240 |
+
}
|
2241 |
+
if(!tmp.li_attr.id) {
|
2242 |
+
tmp.li_attr.id = tid;
|
2243 |
+
}
|
2244 |
+
if(d && typeof d.a_attr === 'object') {
|
2245 |
+
for (i in d.a_attr) {
|
2246 |
+
if(d.a_attr.hasOwnProperty(i)) {
|
2247 |
+
tmp.a_attr[i] = d.a_attr[i];
|
2248 |
+
}
|
2249 |
+
}
|
2250 |
+
}
|
2251 |
+
if(d && d.children && d.children === true) {
|
2252 |
+
tmp.state.loaded = false;
|
2253 |
+
tmp.children = [];
|
2254 |
+
tmp.children_d = [];
|
2255 |
+
}
|
2256 |
+
m[tmp.id] = tmp;
|
2257 |
+
for(i = 0, j = tmp.children.length; i < j; i++) {
|
2258 |
+
c = this._parse_model_from_flat_json(m[tmp.children[i]], tmp.id, ps);
|
2259 |
+
e = m[c];
|
2260 |
+
tmp.children_d.push(c);
|
2261 |
+
if(e.children_d.length) {
|
2262 |
+
tmp.children_d = tmp.children_d.concat(e.children_d);
|
2263 |
+
}
|
2264 |
+
}
|
2265 |
+
delete d.data;
|
2266 |
+
delete d.children;
|
2267 |
+
m[tmp.id].original = d;
|
2268 |
+
if(tmp.state.selected) {
|
2269 |
+
this._data.core.selected.push(tmp.id);
|
2270 |
+
}
|
2271 |
+
return tmp.id;
|
2272 |
+
},
|
2273 |
+
/**
|
2274 |
+
* parses a node from a JSON object and appends it to the in memory tree model. Used internally.
|
2275 |
+
* @private
|
2276 |
+
* @name _parse_model_from_json(d [, p, ps])
|
2277 |
+
* @param {Object} d the JSON object to parse
|
2278 |
+
* @param {String} p the parent ID
|
2279 |
+
* @param {Array} ps list of all parents
|
2280 |
+
* @return {String} the ID of the object added to the model
|
2281 |
+
*/
|
2282 |
+
_parse_model_from_json : function (d, p, ps) {
|
2283 |
+
if(!ps) { ps = []; }
|
2284 |
+
else { ps = ps.concat(); }
|
2285 |
+
if(p) { ps.unshift(p); }
|
2286 |
+
var tid = false, i, j, c, e, m = this._model.data, df = this._model.default_state, tmp;
|
2287 |
+
do {
|
2288 |
+
tid = 'j' + this._id + '_' + (++this._cnt);
|
2289 |
+
} while(m[tid]);
|
2290 |
+
|
2291 |
+
tmp = {
|
2292 |
+
id : false,
|
2293 |
+
text : typeof d === 'string' ? d : '',
|
2294 |
+
icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true,
|
2295 |
+
parent : p,
|
2296 |
+
parents : ps,
|
2297 |
+
children : [],
|
2298 |
+
children_d : [],
|
2299 |
+
data : null,
|
2300 |
+
state : { },
|
2301 |
+
li_attr : { id : false },
|
2302 |
+
a_attr : { href : '#' },
|
2303 |
+
original : false
|
2304 |
+
};
|
2305 |
+
for(i in df) {
|
2306 |
+
if(df.hasOwnProperty(i)) {
|
2307 |
+
tmp.state[i] = df[i];
|
2308 |
+
}
|
2309 |
+
}
|
2310 |
+
if(d && d.id) { tmp.id = d.id.toString(); }
|
2311 |
+
if(d && d.text) { tmp.text = d.text; }
|
2312 |
+
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
|
2313 |
+
tmp.icon = d.data.jstree.icon;
|
2314 |
+
}
|
2315 |
+
if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") {
|
2316 |
+
tmp.icon = true;
|
2317 |
+
}
|
2318 |
+
if(d && d.data) {
|
2319 |
+
tmp.data = d.data;
|
2320 |
+
if(d.data.jstree) {
|
2321 |
+
for(i in d.data.jstree) {
|
2322 |
+
if(d.data.jstree.hasOwnProperty(i)) {
|
2323 |
+
tmp.state[i] = d.data.jstree[i];
|
2324 |
+
}
|
2325 |
+
}
|
2326 |
+
}
|
2327 |
+
}
|
2328 |
+
if(d && typeof d.state === 'object') {
|
2329 |
+
for (i in d.state) {
|
2330 |
+
if(d.state.hasOwnProperty(i)) {
|
2331 |
+
tmp.state[i] = d.state[i];
|
2332 |
+
}
|
2333 |
+
}
|
2334 |
+
}
|
2335 |
+
if(d && typeof d.li_attr === 'object') {
|
2336 |
+
for (i in d.li_attr) {
|
2337 |
+
if(d.li_attr.hasOwnProperty(i)) {
|
2338 |
+
tmp.li_attr[i] = d.li_attr[i];
|
2339 |
+
}
|
2340 |
+
}
|
2341 |
+
}
|
2342 |
+
if(tmp.li_attr.id && !tmp.id) {
|
2343 |
+
tmp.id = tmp.li_attr.id.toString();
|
2344 |
+
}
|
2345 |
+
if(!tmp.id) {
|
2346 |
+
tmp.id = tid;
|
2347 |
+
}
|
2348 |
+
if(!tmp.li_attr.id) {
|
2349 |
+
tmp.li_attr.id = tmp.id;
|
2350 |
+
}
|
2351 |
+
if(d && typeof d.a_attr === 'object') {
|
2352 |
+
for (i in d.a_attr) {
|
2353 |
+
if(d.a_attr.hasOwnProperty(i)) {
|
2354 |
+
tmp.a_attr[i] = d.a_attr[i];
|
2355 |
+
}
|
2356 |
+
}
|
2357 |
+
}
|
2358 |
+
if(d && d.children && d.children.length) {
|
2359 |
+
for(i = 0, j = d.children.length; i < j; i++) {
|
2360 |
+
c = this._parse_model_from_json(d.children[i], tmp.id, ps);
|
2361 |
+
e = m[c];
|
2362 |
+
tmp.children.push(c);
|
2363 |
+
if(e.children_d.length) {
|
2364 |
+
tmp.children_d = tmp.children_d.concat(e.children_d);
|
2365 |
+
}
|
2366 |
+
}
|
2367 |
+
tmp.children_d = tmp.children.concat(tmp.children_d);
|
2368 |
+
}
|
2369 |
+
if(d && d.children && d.children === true) {
|
2370 |
+
tmp.state.loaded = false;
|
2371 |
+
tmp.children = [];
|
2372 |
+
tmp.children_d = [];
|
2373 |
+
}
|
2374 |
+
delete d.data;
|
2375 |
+
delete d.children;
|
2376 |
+
tmp.original = d;
|
2377 |
+
m[tmp.id] = tmp;
|
2378 |
+
if(tmp.state.selected) {
|
2379 |
+
this._data.core.selected.push(tmp.id);
|
2380 |
+
}
|
2381 |
+
return tmp.id;
|
2382 |
+
},
|
2383 |
+
/**
|
2384 |
+
* redraws all nodes that need to be redrawn. Used internally.
|
2385 |
+
* @private
|
2386 |
+
* @name _redraw()
|
2387 |
+
* @trigger redraw.jstree
|
2388 |
+
*/
|
2389 |
+
_redraw : function () {
|
2390 |
+
var nodes = this._model.force_full_redraw ? this._model.data[$.jstree.root].children.concat([]) : this._model.changed.concat([]),
|
2391 |
+
f = document.createElement('UL'), tmp, i, j, fe = this._data.core.focused;
|
2392 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
2393 |
+
tmp = this.redraw_node(nodes[i], true, this._model.force_full_redraw);
|
2394 |
+
if(tmp && this._model.force_full_redraw) {
|
2395 |
+
f.appendChild(tmp);
|
2396 |
+
}
|
2397 |
+
}
|
2398 |
+
if(this._model.force_full_redraw) {
|
2399 |
+
f.className = this.get_container_ul()[0].className;
|
2400 |
+
f.setAttribute('role','group');
|
2401 |
+
this.element.empty().append(f);
|
2402 |
+
//this.get_container_ul()[0].appendChild(f);
|
2403 |
+
}
|
2404 |
+
if(fe !== null && this.settings.core.restore_focus) {
|
2405 |
+
tmp = this.get_node(fe, true);
|
2406 |
+
if(tmp && tmp.length && tmp.children('.jstree-anchor')[0] !== document.activeElement) {
|
2407 |
+
tmp.children('.jstree-anchor').focus();
|
2408 |
+
}
|
2409 |
+
else {
|
2410 |
+
this._data.core.focused = null;
|
2411 |
+
}
|
2412 |
+
}
|
2413 |
+
this._model.force_full_redraw = false;
|
2414 |
+
this._model.changed = [];
|
2415 |
+
/**
|
2416 |
+
* triggered after nodes are redrawn
|
2417 |
+
* @event
|
2418 |
+
* @name redraw.jstree
|
2419 |
+
* @param {array} nodes the redrawn nodes
|
2420 |
+
*/
|
2421 |
+
this.trigger('redraw', { "nodes" : nodes });
|
2422 |
+
},
|
2423 |
+
/**
|
2424 |
+
* redraws all nodes that need to be redrawn or optionally - the whole tree
|
2425 |
+
* @name redraw([full])
|
2426 |
+
* @param {Boolean} full if set to `true` all nodes are redrawn.
|
2427 |
+
*/
|
2428 |
+
redraw : function (full) {
|
2429 |
+
if(full) {
|
2430 |
+
this._model.force_full_redraw = true;
|
2431 |
+
}
|
2432 |
+
//if(this._model.redraw_timeout) {
|
2433 |
+
// clearTimeout(this._model.redraw_timeout);
|
2434 |
+
//}
|
2435 |
+
//this._model.redraw_timeout = setTimeout($.proxy(this._redraw, this),0);
|
2436 |
+
this._redraw();
|
2437 |
+
},
|
2438 |
+
/**
|
2439 |
+
* redraws a single node's children. Used internally.
|
2440 |
+
* @private
|
2441 |
+
* @name draw_children(node)
|
2442 |
+
* @param {mixed} node the node whose children will be redrawn
|
2443 |
+
*/
|
2444 |
+
draw_children : function (node) {
|
2445 |
+
var obj = this.get_node(node),
|
2446 |
+
i = false,
|
2447 |
+
j = false,
|
2448 |
+
k = false,
|
2449 |
+
d = document;
|
2450 |
+
if(!obj) { return false; }
|
2451 |
+
if(obj.id === $.jstree.root) { return this.redraw(true); }
|
2452 |
+
node = this.get_node(node, true);
|
2453 |
+
if(!node || !node.length) { return false; } // TODO: quick toggle
|
2454 |
+
|
2455 |
+
node.children('.jstree-children').remove();
|
2456 |
+
node = node[0];
|
2457 |
+
if(obj.children.length && obj.state.loaded) {
|
2458 |
+
k = d.createElement('UL');
|
2459 |
+
k.setAttribute('role', 'group');
|
2460 |
+
k.className = 'jstree-children';
|
2461 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
2462 |
+
k.appendChild(this.redraw_node(obj.children[i], true, true));
|
2463 |
+
}
|
2464 |
+
node.appendChild(k);
|
2465 |
+
}
|
2466 |
+
},
|
2467 |
+
/**
|
2468 |
+
* redraws a single node. Used internally.
|
2469 |
+
* @private
|
2470 |
+
* @name redraw_node(node, deep, is_callback, force_render)
|
2471 |
+
* @param {mixed} node the node to redraw
|
2472 |
+
* @param {Boolean} deep should child nodes be redrawn too
|
2473 |
+
* @param {Boolean} is_callback is this a recursion call
|
2474 |
+
* @param {Boolean} force_render should children of closed parents be drawn anyway
|
2475 |
+
*/
|
2476 |
+
redraw_node : function (node, deep, is_callback, force_render) {
|
2477 |
+
var obj = this.get_node(node),
|
2478 |
+
par = false,
|
2479 |
+
ind = false,
|
2480 |
+
old = false,
|
2481 |
+
i = false,
|
2482 |
+
j = false,
|
2483 |
+
k = false,
|
2484 |
+
c = '',
|
2485 |
+
d = document,
|
2486 |
+
m = this._model.data,
|
2487 |
+
f = false,
|
2488 |
+
s = false,
|
2489 |
+
tmp = null,
|
2490 |
+
t = 0,
|
2491 |
+
l = 0,
|
2492 |
+
has_children = false,
|
2493 |
+
last_sibling = false;
|
2494 |
+
if(!obj) { return false; }
|
2495 |
+
if(obj.id === $.jstree.root) { return this.redraw(true); }
|
2496 |
+
deep = deep || obj.children.length === 0;
|
2497 |
+
node = !document.querySelector ? document.getElementById(obj.id) : this.element[0].querySelector('#' + ("0123456789".indexOf(obj.id[0]) !== -1 ? '\\3' + obj.id[0] + ' ' + obj.id.substr(1).replace($.jstree.idregex,'\\$&') : obj.id.replace($.jstree.idregex,'\\$&')) ); //, this.element);
|
2498 |
+
if(!node) {
|
2499 |
+
deep = true;
|
2500 |
+
//node = d.createElement('LI');
|
2501 |
+
if(!is_callback) {
|
2502 |
+
par = obj.parent !== $.jstree.root ? $('#' + obj.parent.replace($.jstree.idregex,'\\$&'), this.element)[0] : null;
|
2503 |
+
if(par !== null && (!par || !m[obj.parent].state.opened)) {
|
2504 |
+
return false;
|
2505 |
+
}
|
2506 |
+
ind = $.inArray(obj.id, par === null ? m[$.jstree.root].children : m[obj.parent].children);
|
2507 |
+
}
|
2508 |
+
}
|
2509 |
+
else {
|
2510 |
+
node = $(node);
|
2511 |
+
if(!is_callback) {
|
2512 |
+
par = node.parent().parent()[0];
|
2513 |
+
if(par === this.element[0]) {
|
2514 |
+
par = null;
|
2515 |
+
}
|
2516 |
+
ind = node.index();
|
2517 |
+
}
|
2518 |
+
// m[obj.id].data = node.data(); // use only node's data, no need to touch jquery storage
|
2519 |
+
if(!deep && obj.children.length && !node.children('.jstree-children').length) {
|
2520 |
+
deep = true;
|
2521 |
+
}
|
2522 |
+
if(!deep) {
|
2523 |
+
old = node.children('.jstree-children')[0];
|
2524 |
+
}
|
2525 |
+
f = node.children('.jstree-anchor')[0] === document.activeElement;
|
2526 |
+
node.remove();
|
2527 |
+
//node = d.createElement('LI');
|
2528 |
+
//node = node[0];
|
2529 |
+
}
|
2530 |
+
node = this._data.core.node.cloneNode(true);
|
2531 |
+
// node is DOM, deep is boolean
|
2532 |
+
|
2533 |
+
c = 'jstree-node ';
|
2534 |
+
for(i in obj.li_attr) {
|
2535 |
+
if(obj.li_attr.hasOwnProperty(i)) {
|
2536 |
+
if(i === 'id') { continue; }
|
2537 |
+
if(i !== 'class') {
|
2538 |
+
node.setAttribute(i, obj.li_attr[i]);
|
2539 |
+
}
|
2540 |
+
else {
|
2541 |
+
c += obj.li_attr[i];
|
2542 |
+
}
|
2543 |
+
}
|
2544 |
+
}
|
2545 |
+
if(!obj.a_attr.id) {
|
2546 |
+
obj.a_attr.id = obj.id + '_anchor';
|
2547 |
+
}
|
2548 |
+
node.setAttribute('aria-selected', !!obj.state.selected);
|
2549 |
+
node.childNodes[1].setAttribute('aria-selected', !!obj.state.selected);
|
2550 |
+
node.setAttribute('aria-level', obj.parents.length);
|
2551 |
+
node.childNodes[1].setAttribute('aria-level', obj.parents.length);
|
2552 |
+
|
2553 |
+
node.setAttribute('aria-labelledby', obj.a_attr.id);
|
2554 |
+
node.setAttribute('data-folder', obj.id);
|
2555 |
+
if(obj.state.disabled) {
|
2556 |
+
node.setAttribute('aria-disabled', true);
|
2557 |
+
node.childNodes[1].setAttribute('aria-disabled', true);
|
2558 |
+
}
|
2559 |
+
|
2560 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
2561 |
+
if(!m[obj.children[i]].state.hidden) {
|
2562 |
+
has_children = true;
|
2563 |
+
break;
|
2564 |
+
}
|
2565 |
+
}
|
2566 |
+
if(obj.parent !== null && m[obj.parent] && !obj.state.hidden) {
|
2567 |
+
i = $.inArray(obj.id, m[obj.parent].children);
|
2568 |
+
last_sibling = obj.id;
|
2569 |
+
if(i !== -1) {
|
2570 |
+
i++;
|
2571 |
+
for(j = m[obj.parent].children.length; i < j; i++) {
|
2572 |
+
if(!m[m[obj.parent].children[i]].state.hidden) {
|
2573 |
+
last_sibling = m[obj.parent].children[i];
|
2574 |
+
}
|
2575 |
+
if(last_sibling !== obj.id) {
|
2576 |
+
break;
|
2577 |
+
}
|
2578 |
+
}
|
2579 |
+
}
|
2580 |
+
}
|
2581 |
+
|
2582 |
+
if(obj.state.hidden) {
|
2583 |
+
c += ' jstree-hidden';
|
2584 |
+
}
|
2585 |
+
if (obj.state.loading) {
|
2586 |
+
c += ' jstree-loading';
|
2587 |
+
}
|
2588 |
+
if(obj.state.loaded && !has_children) {
|
2589 |
+
c += ' jstree-leaf';
|
2590 |
+
}
|
2591 |
+
else {
|
2592 |
+
c += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed';
|
2593 |
+
node.setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) );
|
2594 |
+
node.childNodes[1].setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) );
|
2595 |
+
}
|
2596 |
+
if(last_sibling === obj.id) {
|
2597 |
+
c += ' jstree-last';
|
2598 |
+
}
|
2599 |
+
node.id = obj.id;
|
2600 |
+
node.className = c;
|
2601 |
+
c = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : '');
|
2602 |
+
for(j in obj.a_attr) {
|
2603 |
+
if(obj.a_attr.hasOwnProperty(j)) {
|
2604 |
+
if(j === 'href' && obj.a_attr[j] === '#') { continue; }
|
2605 |
+
if(j !== 'class') {
|
2606 |
+
node.childNodes[1].setAttribute(j, obj.a_attr[j]);
|
2607 |
+
}
|
2608 |
+
else {
|
2609 |
+
c += ' ' + obj.a_attr[j];
|
2610 |
+
}
|
2611 |
+
}
|
2612 |
+
}
|
2613 |
+
if(c.length) {
|
2614 |
+
node.childNodes[1].className = 'jstree-anchor ' + c;
|
2615 |
+
}
|
2616 |
+
if((obj.icon && obj.icon !== true) || obj.icon === false) {
|
2617 |
+
if(obj.icon === false) {
|
2618 |
+
node.childNodes[1].childNodes[0].className += ' jstree-themeicon-hidden';
|
2619 |
+
}
|
2620 |
+
else if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) {
|
2621 |
+
node.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom';
|
2622 |
+
}
|
2623 |
+
else {
|
2624 |
+
node.childNodes[1].childNodes[0].style.backgroundImage = 'url("'+obj.icon+'")';
|
2625 |
+
node.childNodes[1].childNodes[0].style.backgroundPosition = 'center center';
|
2626 |
+
node.childNodes[1].childNodes[0].style.backgroundSize = 'auto';
|
2627 |
+
node.childNodes[1].childNodes[0].className += ' jstree-themeicon-custom';
|
2628 |
+
}
|
2629 |
+
}
|
2630 |
+
|
2631 |
+
if(this.settings.core.force_text) {
|
2632 |
+
node.childNodes[1].appendChild(d.createTextNode(obj.text));
|
2633 |
+
}
|
2634 |
+
else {
|
2635 |
+
node.childNodes[1].innerHTML += obj.text;
|
2636 |
+
}
|
2637 |
+
|
2638 |
+
|
2639 |
+
if(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) {
|
2640 |
+
k = d.createElement('UL');
|
2641 |
+
k.setAttribute('role', 'group');
|
2642 |
+
k.className = 'jstree-children';
|
2643 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
2644 |
+
k.appendChild(this.redraw_node(obj.children[i], deep, true));
|
2645 |
+
}
|
2646 |
+
node.appendChild(k);
|
2647 |
+
}
|
2648 |
+
if(old) {
|
2649 |
+
node.appendChild(old);
|
2650 |
+
}
|
2651 |
+
if(!is_callback) {
|
2652 |
+
// append back using par / ind
|
2653 |
+
if(!par) {
|
2654 |
+
par = this.element[0];
|
2655 |
+
}
|
2656 |
+
for(i = 0, j = par.childNodes.length; i < j; i++) {
|
2657 |
+
if(par.childNodes[i] && par.childNodes[i].className && par.childNodes[i].className.indexOf('jstree-children') !== -1) {
|
2658 |
+
tmp = par.childNodes[i];
|
2659 |
+
break;
|
2660 |
+
}
|
2661 |
+
}
|
2662 |
+
if(!tmp) {
|
2663 |
+
tmp = d.createElement('UL');
|
2664 |
+
tmp.setAttribute('role', 'group');
|
2665 |
+
tmp.className = 'jstree-children';
|
2666 |
+
par.appendChild(tmp);
|
2667 |
+
}
|
2668 |
+
par = tmp;
|
2669 |
+
|
2670 |
+
if(ind < par.childNodes.length) {
|
2671 |
+
par.insertBefore(node, par.childNodes[ind]);
|
2672 |
+
}
|
2673 |
+
else {
|
2674 |
+
par.appendChild(node);
|
2675 |
+
}
|
2676 |
+
if(f) {
|
2677 |
+
t = this.element[0].scrollTop;
|
2678 |
+
l = this.element[0].scrollLeft;
|
2679 |
+
node.childNodes[1].focus();
|
2680 |
+
this.element[0].scrollTop = t;
|
2681 |
+
this.element[0].scrollLeft = l;
|
2682 |
+
}
|
2683 |
+
}
|
2684 |
+
if(obj.state.opened && !obj.state.loaded) {
|
2685 |
+
obj.state.opened = false;
|
2686 |
+
setTimeout($.proxy(function () {
|
2687 |
+
this.open_node(obj.id, false, 0);
|
2688 |
+
}, this), 0);
|
2689 |
+
}
|
2690 |
+
return node;
|
2691 |
+
},
|
2692 |
+
/**
|
2693 |
+
* opens a node, revealing its children. If the node is not loaded it will be loaded and opened once ready.
|
2694 |
+
* @name open_node(obj [, callback, animation])
|
2695 |
+
* @param {mixed} obj the node to open
|
2696 |
+
* @param {Function} callback a function to execute once the node is opened
|
2697 |
+
* @param {Number} animation the animation duration in milliseconds when opening the node (overrides the `core.animation` setting). Use `false` for no animation.
|
2698 |
+
* @trigger open_node.jstree, after_open.jstree, before_open.jstree
|
2699 |
+
*/
|
2700 |
+
open_node : function (obj, callback, animation) {
|
2701 |
+
var t1, t2, d, t;
|
2702 |
+
if($.isArray(obj)) {
|
2703 |
+
obj = obj.slice();
|
2704 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2705 |
+
this.open_node(obj[t1], callback, animation);
|
2706 |
+
}
|
2707 |
+
return true;
|
2708 |
+
}
|
2709 |
+
obj = this.get_node(obj);
|
2710 |
+
if(!obj || obj.id === $.jstree.root) {
|
2711 |
+
return false;
|
2712 |
+
}
|
2713 |
+
animation = animation === undefined ? this.settings.core.animation : animation;
|
2714 |
+
if(!this.is_closed(obj)) {
|
2715 |
+
if(callback) {
|
2716 |
+
callback.call(this, obj, false);
|
2717 |
+
}
|
2718 |
+
return false;
|
2719 |
+
}
|
2720 |
+
if(!this.is_loaded(obj)) {
|
2721 |
+
if(this.is_loading(obj)) {
|
2722 |
+
return setTimeout($.proxy(function () {
|
2723 |
+
this.open_node(obj, callback, animation);
|
2724 |
+
}, this), 500);
|
2725 |
+
}
|
2726 |
+
this.load_node(obj, function (o, ok) {
|
2727 |
+
return ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false);
|
2728 |
+
});
|
2729 |
+
}
|
2730 |
+
else {
|
2731 |
+
d = this.get_node(obj, true);
|
2732 |
+
t = this;
|
2733 |
+
if(d.length) {
|
2734 |
+
if(animation && d.children(".jstree-children").length) {
|
2735 |
+
d.children(".jstree-children").stop(true, true);
|
2736 |
+
}
|
2737 |
+
if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) {
|
2738 |
+
this.draw_children(obj);
|
2739 |
+
//d = this.get_node(obj, true);
|
2740 |
+
}
|
2741 |
+
if(!animation) {
|
2742 |
+
this.trigger('before_open', { "node" : obj });
|
2743 |
+
d[0].className = d[0].className.replace('jstree-closed', 'jstree-open');
|
2744 |
+
d[0].setAttribute("aria-expanded", true);
|
2745 |
+
d[0].childNodes[1].setAttribute("aria-expanded", true);
|
2746 |
+
}
|
2747 |
+
else {
|
2748 |
+
this.trigger('before_open', { "node" : obj });
|
2749 |
+
d
|
2750 |
+
.children(".jstree-children").css("display","none").end()
|
2751 |
+
.removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", true)
|
2752 |
+
.children('.jstree-anchor').attr("aria-expanded", true).end()
|
2753 |
+
.children(".jstree-children").stop(true, true)
|
2754 |
+
.slideDown(animation, function () {
|
2755 |
+
this.style.display = "";
|
2756 |
+
if (t.element) {
|
2757 |
+
t.trigger("after_open", { "node" : obj });
|
2758 |
+
}
|
2759 |
+
});
|
2760 |
+
}
|
2761 |
+
}
|
2762 |
+
obj.state.opened = true;
|
2763 |
+
if(callback) {
|
2764 |
+
callback.call(this, obj, true);
|
2765 |
+
}
|
2766 |
+
if(!d.length) {
|
2767 |
+
/**
|
2768 |
+
* triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet)
|
2769 |
+
* @event
|
2770 |
+
* @name before_open.jstree
|
2771 |
+
* @param {Object} node the opened node
|
2772 |
+
*/
|
2773 |
+
this.trigger('before_open', { "node" : obj });
|
2774 |
+
}
|
2775 |
+
/**
|
2776 |
+
* triggered when a node is opened (if there is an animation it will not be completed yet)
|
2777 |
+
* @event
|
2778 |
+
* @name open_node.jstree
|
2779 |
+
* @param {Object} node the opened node
|
2780 |
+
*/
|
2781 |
+
this.trigger('open_node', { "node" : obj });
|
2782 |
+
if(!animation || !d.length) {
|
2783 |
+
/**
|
2784 |
+
* triggered when a node is opened and the animation is complete
|
2785 |
+
* @event
|
2786 |
+
* @name after_open.jstree
|
2787 |
+
* @param {Object} node the opened node
|
2788 |
+
*/
|
2789 |
+
this.trigger("after_open", { "node" : obj });
|
2790 |
+
}
|
2791 |
+
return true;
|
2792 |
+
}
|
2793 |
+
},
|
2794 |
+
/**
|
2795 |
+
* opens every parent of a node (node should be loaded)
|
2796 |
+
* @name _open_to(obj)
|
2797 |
+
* @param {mixed} obj the node to reveal
|
2798 |
+
* @private
|
2799 |
+
*/
|
2800 |
+
_open_to : function (obj) {
|
2801 |
+
obj = this.get_node(obj);
|
2802 |
+
if(!obj || obj.id === $.jstree.root) {
|
2803 |
+
return false;
|
2804 |
+
}
|
2805 |
+
var i, j, p = obj.parents;
|
2806 |
+
for(i = 0, j = p.length; i < j; i+=1) {
|
2807 |
+
if(i !== $.jstree.root) {
|
2808 |
+
this.open_node(p[i], false, 0);
|
2809 |
+
}
|
2810 |
+
}
|
2811 |
+
return $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element);
|
2812 |
+
},
|
2813 |
+
/**
|
2814 |
+
* closes a node, hiding its children
|
2815 |
+
* @name close_node(obj [, animation])
|
2816 |
+
* @param {mixed} obj the node to close
|
2817 |
+
* @param {Number} animation the animation duration in milliseconds when closing the node (overrides the `core.animation` setting). Use `false` for no animation.
|
2818 |
+
* @trigger close_node.jstree, after_close.jstree
|
2819 |
+
*/
|
2820 |
+
close_node : function (obj, animation) {
|
2821 |
+
var t1, t2, t, d;
|
2822 |
+
if($.isArray(obj)) {
|
2823 |
+
obj = obj.slice();
|
2824 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2825 |
+
this.close_node(obj[t1], animation);
|
2826 |
+
}
|
2827 |
+
return true;
|
2828 |
+
}
|
2829 |
+
obj = this.get_node(obj);
|
2830 |
+
if(!obj || obj.id === $.jstree.root) {
|
2831 |
+
return false;
|
2832 |
+
}
|
2833 |
+
if(this.is_closed(obj)) {
|
2834 |
+
return false;
|
2835 |
+
}
|
2836 |
+
animation = animation === undefined ? this.settings.core.animation : animation;
|
2837 |
+
t = this;
|
2838 |
+
d = this.get_node(obj, true);
|
2839 |
+
|
2840 |
+
obj.state.opened = false;
|
2841 |
+
/**
|
2842 |
+
* triggered when a node is closed (if there is an animation it will not be complete yet)
|
2843 |
+
* @event
|
2844 |
+
* @name close_node.jstree
|
2845 |
+
* @param {Object} node the closed node
|
2846 |
+
*/
|
2847 |
+
this.trigger('close_node',{ "node" : obj });
|
2848 |
+
if(!d.length) {
|
2849 |
+
/**
|
2850 |
+
* triggered when a node is closed and the animation is complete
|
2851 |
+
* @event
|
2852 |
+
* @name after_close.jstree
|
2853 |
+
* @param {Object} node the closed node
|
2854 |
+
*/
|
2855 |
+
this.trigger("after_close", { "node" : obj });
|
2856 |
+
}
|
2857 |
+
else {
|
2858 |
+
if(!animation) {
|
2859 |
+
d[0].className = d[0].className.replace('jstree-open', 'jstree-closed');
|
2860 |
+
d.children('.jstree-anchor').attr("aria-expanded", false);
|
2861 |
+
d.attr("aria-expanded", false).children('.jstree-children').remove();
|
2862 |
+
this.trigger("after_close", { "node" : obj });
|
2863 |
+
}
|
2864 |
+
else {
|
2865 |
+
d
|
2866 |
+
.children(".jstree-children").attr("style","display:block !important").end()
|
2867 |
+
.removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false)
|
2868 |
+
.children('.jstree-anchor').attr("aria-expanded", false).end()
|
2869 |
+
.children(".jstree-children").stop(true, true).slideUp(animation, function () {
|
2870 |
+
this.style.display = "";
|
2871 |
+
d.children('.jstree-children').remove();
|
2872 |
+
if (t.element) {
|
2873 |
+
t.trigger("after_close", { "node" : obj });
|
2874 |
+
}
|
2875 |
+
});
|
2876 |
+
}
|
2877 |
+
}
|
2878 |
+
},
|
2879 |
+
/**
|
2880 |
+
* toggles a node - closing it if it is open, opening it if it is closed
|
2881 |
+
* @name toggle_node(obj)
|
2882 |
+
* @param {mixed} obj the node to toggle
|
2883 |
+
*/
|
2884 |
+
toggle_node : function (obj) {
|
2885 |
+
var t1, t2;
|
2886 |
+
if($.isArray(obj)) {
|
2887 |
+
obj = obj.slice();
|
2888 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2889 |
+
this.toggle_node(obj[t1]);
|
2890 |
+
}
|
2891 |
+
return true;
|
2892 |
+
}
|
2893 |
+
if(this.is_closed(obj)) {
|
2894 |
+
return this.open_node(obj);
|
2895 |
+
}
|
2896 |
+
if(this.is_open(obj)) {
|
2897 |
+
return this.close_node(obj);
|
2898 |
+
}
|
2899 |
+
},
|
2900 |
+
/**
|
2901 |
+
* opens all nodes within a node (or the tree), revealing their children. If the node is not loaded it will be loaded and opened once ready.
|
2902 |
+
* @name open_all([obj, animation, original_obj])
|
2903 |
+
* @param {mixed} obj the node to open recursively, omit to open all nodes in the tree
|
2904 |
+
* @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation
|
2905 |
+
* @param {jQuery} reference to the node that started the process (internal use)
|
2906 |
+
* @trigger open_all.jstree
|
2907 |
+
*/
|
2908 |
+
open_all : function (obj, animation, original_obj) {
|
2909 |
+
if(!obj) { obj = $.jstree.root; }
|
2910 |
+
obj = this.get_node(obj);
|
2911 |
+
if(!obj) { return false; }
|
2912 |
+
var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), i, j, _this;
|
2913 |
+
if(!dom.length) {
|
2914 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
2915 |
+
if(this.is_closed(this._model.data[obj.children_d[i]])) {
|
2916 |
+
this._model.data[obj.children_d[i]].state.opened = true;
|
2917 |
+
}
|
2918 |
+
}
|
2919 |
+
return this.trigger('open_all', { "node" : obj });
|
2920 |
+
}
|
2921 |
+
original_obj = original_obj || dom;
|
2922 |
+
_this = this;
|
2923 |
+
dom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed');
|
2924 |
+
dom.each(function () {
|
2925 |
+
_this.open_node(
|
2926 |
+
this,
|
2927 |
+
function(node, status) { if(status && this.is_parent(node)) { this.open_all(node, animation, original_obj); } },
|
2928 |
+
animation || 0
|
2929 |
+
);
|
2930 |
+
});
|
2931 |
+
if(original_obj.find('.jstree-closed').length === 0) {
|
2932 |
+
/**
|
2933 |
+
* triggered when an `open_all` call completes
|
2934 |
+
* @event
|
2935 |
+
* @name open_all.jstree
|
2936 |
+
* @param {Object} node the opened node
|
2937 |
+
*/
|
2938 |
+
this.trigger('open_all', { "node" : this.get_node(original_obj) });
|
2939 |
+
}
|
2940 |
+
},
|
2941 |
+
/**
|
2942 |
+
* closes all nodes within a node (or the tree), revealing their children
|
2943 |
+
* @name close_all([obj, animation])
|
2944 |
+
* @param {mixed} obj the node to close recursively, omit to close all nodes in the tree
|
2945 |
+
* @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation
|
2946 |
+
* @trigger close_all.jstree
|
2947 |
+
*/
|
2948 |
+
close_all : function (obj, animation) {
|
2949 |
+
if(!obj) { obj = $.jstree.root; }
|
2950 |
+
obj = this.get_node(obj);
|
2951 |
+
if(!obj) { return false; }
|
2952 |
+
var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true),
|
2953 |
+
_this = this, i, j;
|
2954 |
+
if(dom.length) {
|
2955 |
+
dom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open');
|
2956 |
+
$(dom.get().reverse()).each(function () { _this.close_node(this, animation || 0); });
|
2957 |
+
}
|
2958 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
2959 |
+
this._model.data[obj.children_d[i]].state.opened = false;
|
2960 |
+
}
|
2961 |
+
/**
|
2962 |
+
* triggered when an `close_all` call completes
|
2963 |
+
* @event
|
2964 |
+
* @name close_all.jstree
|
2965 |
+
* @param {Object} node the closed node
|
2966 |
+
*/
|
2967 |
+
this.trigger('close_all', { "node" : obj });
|
2968 |
+
},
|
2969 |
+
/**
|
2970 |
+
* checks if a node is disabled (not selectable)
|
2971 |
+
* @name is_disabled(obj)
|
2972 |
+
* @param {mixed} obj
|
2973 |
+
* @return {Boolean}
|
2974 |
+
*/
|
2975 |
+
is_disabled : function (obj) {
|
2976 |
+
obj = this.get_node(obj);
|
2977 |
+
return obj && obj.state && obj.state.disabled;
|
2978 |
+
},
|
2979 |
+
/**
|
2980 |
+
* enables a node - so that it can be selected
|
2981 |
+
* @name enable_node(obj)
|
2982 |
+
* @param {mixed} obj the node to enable
|
2983 |
+
* @trigger enable_node.jstree
|
2984 |
+
*/
|
2985 |
+
enable_node : function (obj) {
|
2986 |
+
var t1, t2;
|
2987 |
+
if($.isArray(obj)) {
|
2988 |
+
obj = obj.slice();
|
2989 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
2990 |
+
this.enable_node(obj[t1]);
|
2991 |
+
}
|
2992 |
+
return true;
|
2993 |
+
}
|
2994 |
+
obj = this.get_node(obj);
|
2995 |
+
if(!obj || obj.id === $.jstree.root) {
|
2996 |
+
return false;
|
2997 |
+
}
|
2998 |
+
obj.state.disabled = false;
|
2999 |
+
this.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disabled', false);
|
3000 |
+
/**
|
3001 |
+
* triggered when an node is enabled
|
3002 |
+
* @event
|
3003 |
+
* @name enable_node.jstree
|
3004 |
+
* @param {Object} node the enabled node
|
3005 |
+
*/
|
3006 |
+
this.trigger('enable_node', { 'node' : obj });
|
3007 |
+
},
|
3008 |
+
/**
|
3009 |
+
* disables a node - so that it can not be selected
|
3010 |
+
* @name disable_node(obj)
|
3011 |
+
* @param {mixed} obj the node to disable
|
3012 |
+
* @trigger disable_node.jstree
|
3013 |
+
*/
|
3014 |
+
disable_node : function (obj) {
|
3015 |
+
var t1, t2;
|
3016 |
+
if($.isArray(obj)) {
|
3017 |
+
obj = obj.slice();
|
3018 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3019 |
+
this.disable_node(obj[t1]);
|
3020 |
+
}
|
3021 |
+
return true;
|
3022 |
+
}
|
3023 |
+
obj = this.get_node(obj);
|
3024 |
+
if(!obj || obj.id === $.jstree.root) {
|
3025 |
+
return false;
|
3026 |
+
}
|
3027 |
+
obj.state.disabled = true;
|
3028 |
+
this.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled', true);
|
3029 |
+
/**
|
3030 |
+
* triggered when an node is disabled
|
3031 |
+
* @event
|
3032 |
+
* @name disable_node.jstree
|
3033 |
+
* @param {Object} node the disabled node
|
3034 |
+
*/
|
3035 |
+
this.trigger('disable_node', { 'node' : obj });
|
3036 |
+
},
|
3037 |
+
/**
|
3038 |
+
* determines if a node is hidden
|
3039 |
+
* @name is_hidden(obj)
|
3040 |
+
* @param {mixed} obj the node
|
3041 |
+
*/
|
3042 |
+
is_hidden : function (obj) {
|
3043 |
+
obj = this.get_node(obj);
|
3044 |
+
return obj.state.hidden === true;
|
3045 |
+
},
|
3046 |
+
/**
|
3047 |
+
* hides a node - it is still in the structure but will not be visible
|
3048 |
+
* @name hide_node(obj)
|
3049 |
+
* @param {mixed} obj the node to hide
|
3050 |
+
* @param {Boolean} skip_redraw internal parameter controlling if redraw is called
|
3051 |
+
* @trigger hide_node.jstree
|
3052 |
+
*/
|
3053 |
+
hide_node : function (obj, skip_redraw) {
|
3054 |
+
var t1, t2;
|
3055 |
+
if($.isArray(obj)) {
|
3056 |
+
obj = obj.slice();
|
3057 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3058 |
+
this.hide_node(obj[t1], true);
|
3059 |
+
}
|
3060 |
+
if (!skip_redraw) {
|
3061 |
+
this.redraw();
|
3062 |
+
}
|
3063 |
+
return true;
|
3064 |
+
}
|
3065 |
+
obj = this.get_node(obj);
|
3066 |
+
if(!obj || obj.id === $.jstree.root) {
|
3067 |
+
return false;
|
3068 |
+
}
|
3069 |
+
if(!obj.state.hidden) {
|
3070 |
+
obj.state.hidden = true;
|
3071 |
+
this._node_changed(obj.parent);
|
3072 |
+
if(!skip_redraw) {
|
3073 |
+
this.redraw();
|
3074 |
+
}
|
3075 |
+
/**
|
3076 |
+
* triggered when an node is hidden
|
3077 |
+
* @event
|
3078 |
+
* @name hide_node.jstree
|
3079 |
+
* @param {Object} node the hidden node
|
3080 |
+
*/
|
3081 |
+
this.trigger('hide_node', { 'node' : obj });
|
3082 |
+
}
|
3083 |
+
},
|
3084 |
+
/**
|
3085 |
+
* shows a node
|
3086 |
+
* @name show_node(obj)
|
3087 |
+
* @param {mixed} obj the node to show
|
3088 |
+
* @param {Boolean} skip_redraw internal parameter controlling if redraw is called
|
3089 |
+
* @trigger show_node.jstree
|
3090 |
+
*/
|
3091 |
+
show_node : function (obj, skip_redraw) {
|
3092 |
+
var t1, t2;
|
3093 |
+
if($.isArray(obj)) {
|
3094 |
+
obj = obj.slice();
|
3095 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3096 |
+
this.show_node(obj[t1], true);
|
3097 |
+
}
|
3098 |
+
if (!skip_redraw) {
|
3099 |
+
this.redraw();
|
3100 |
+
}
|
3101 |
+
return true;
|
3102 |
+
}
|
3103 |
+
obj = this.get_node(obj);
|
3104 |
+
if(!obj || obj.id === $.jstree.root) {
|
3105 |
+
return false;
|
3106 |
+
}
|
3107 |
+
if(obj.state.hidden) {
|
3108 |
+
obj.state.hidden = false;
|
3109 |
+
this._node_changed(obj.parent);
|
3110 |
+
if(!skip_redraw) {
|
3111 |
+
this.redraw();
|
3112 |
+
}
|
3113 |
+
/**
|
3114 |
+
* triggered when an node is shown
|
3115 |
+
* @event
|
3116 |
+
* @name show_node.jstree
|
3117 |
+
* @param {Object} node the shown node
|
3118 |
+
*/
|
3119 |
+
this.trigger('show_node', { 'node' : obj });
|
3120 |
+
}
|
3121 |
+
},
|
3122 |
+
/**
|
3123 |
+
* hides all nodes
|
3124 |
+
* @name hide_all()
|
3125 |
+
* @trigger hide_all.jstree
|
3126 |
+
*/
|
3127 |
+
hide_all : function (skip_redraw) {
|
3128 |
+
var i, m = this._model.data, ids = [];
|
3129 |
+
for(i in m) {
|
3130 |
+
if(m.hasOwnProperty(i) && i !== $.jstree.root && !m[i].state.hidden) {
|
3131 |
+
m[i].state.hidden = true;
|
3132 |
+
ids.push(i);
|
3133 |
+
}
|
3134 |
+
}
|
3135 |
+
this._model.force_full_redraw = true;
|
3136 |
+
if(!skip_redraw) {
|
3137 |
+
this.redraw();
|
3138 |
+
}
|
3139 |
+
/**
|
3140 |
+
* triggered when all nodes are hidden
|
3141 |
+
* @event
|
3142 |
+
* @name hide_all.jstree
|
3143 |
+
* @param {Array} nodes the IDs of all hidden nodes
|
3144 |
+
*/
|
3145 |
+
this.trigger('hide_all', { 'nodes' : ids });
|
3146 |
+
return ids;
|
3147 |
+
},
|
3148 |
+
/**
|
3149 |
+
* shows all nodes
|
3150 |
+
* @name show_all()
|
3151 |
+
* @trigger show_all.jstree
|
3152 |
+
*/
|
3153 |
+
show_all : function (skip_redraw) {
|
3154 |
+
var i, m = this._model.data, ids = [];
|
3155 |
+
for(i in m) {
|
3156 |
+
if(m.hasOwnProperty(i) && i !== $.jstree.root && m[i].state.hidden) {
|
3157 |
+
m[i].state.hidden = false;
|
3158 |
+
ids.push(i);
|
3159 |
+
}
|
3160 |
+
}
|
3161 |
+
this._model.force_full_redraw = true;
|
3162 |
+
if(!skip_redraw) {
|
3163 |
+
this.redraw();
|
3164 |
+
}
|
3165 |
+
/**
|
3166 |
+
* triggered when all nodes are shown
|
3167 |
+
* @event
|
3168 |
+
* @name show_all.jstree
|
3169 |
+
* @param {Array} nodes the IDs of all shown nodes
|
3170 |
+
*/
|
3171 |
+
this.trigger('show_all', { 'nodes' : ids });
|
3172 |
+
return ids;
|
3173 |
+
},
|
3174 |
+
/**
|
3175 |
+
* called when a node is selected by the user. Used internally.
|
3176 |
+
* @private
|
3177 |
+
* @name activate_node(obj, e)
|
3178 |
+
* @param {mixed} obj the node
|
3179 |
+
* @param {Object} e the related event
|
3180 |
+
* @trigger activate_node.jstree, changed.jstree
|
3181 |
+
*/
|
3182 |
+
activate_node : function (obj, e) {
|
3183 |
+
if(typeof e.isTrigger !== "undefined" && e.isTrigger >0) {
|
3184 |
+
return false;
|
3185 |
+
}
|
3186 |
+
if(this.is_disabled(obj)) {
|
3187 |
+
return false;
|
3188 |
+
}
|
3189 |
+
if(!e || typeof e !== 'object') {
|
3190 |
+
e = {};
|
3191 |
+
}
|
3192 |
+
|
3193 |
+
// ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node
|
3194 |
+
this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null;
|
3195 |
+
if(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; }
|
3196 |
+
if(!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]); }
|
3197 |
+
|
3198 |
+
if(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) {
|
3199 |
+
if(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) {
|
3200 |
+
this.deselect_node(obj, false, e);
|
3201 |
+
}
|
3202 |
+
else {
|
3203 |
+
this.deselect_all(true);
|
3204 |
+
this.select_node(obj, false, false, e);
|
3205 |
+
this._data.core.last_clicked = this.get_node(obj);
|
3206 |
+
}
|
3207 |
+
}
|
3208 |
+
else {
|
3209 |
+
if(e.shiftKey) {
|
3210 |
+
var o = this.get_node(obj).id,
|
3211 |
+
l = this._data.core.last_clicked.id,
|
3212 |
+
p = this.get_node(this._data.core.last_clicked.parent).children,
|
3213 |
+
c = false,
|
3214 |
+
i, j;
|
3215 |
+
for(i = 0, j = p.length; i < j; i += 1) {
|
3216 |
+
// separate IFs work whem o and l are the same
|
3217 |
+
if(p[i] === o) {
|
3218 |
+
c = !c;
|
3219 |
+
}
|
3220 |
+
if(p[i] === l) {
|
3221 |
+
c = !c;
|
3222 |
+
}
|
3223 |
+
if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) {
|
3224 |
+
if (!this.is_hidden(p[i])) {
|
3225 |
+
this.select_node(p[i], true, false, e);
|
3226 |
+
}
|
3227 |
+
}
|
3228 |
+
else {
|
3229 |
+
this.deselect_node(p[i], true, e);
|
3230 |
+
}
|
3231 |
+
}
|
3232 |
+
this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e });
|
3233 |
+
}
|
3234 |
+
else {
|
3235 |
+
if(!this.is_selected(obj)) {
|
3236 |
+
this.select_node(obj, false, false, e);
|
3237 |
+
}
|
3238 |
+
else {
|
3239 |
+
this.deselect_node(obj, false, e);
|
3240 |
+
}
|
3241 |
+
}
|
3242 |
+
}
|
3243 |
+
/**
|
3244 |
+
* triggered when an node is clicked or intercated with by the user
|
3245 |
+
* @event
|
3246 |
+
* @name activate_node.jstree
|
3247 |
+
* @param {Object} node
|
3248 |
+
* @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object)
|
3249 |
+
*/
|
3250 |
+
this.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e });
|
3251 |
+
},
|
3252 |
+
/**
|
3253 |
+
* applies the hover state on a node, called when a node is hovered by the user. Used internally.
|
3254 |
+
* @private
|
3255 |
+
* @name hover_node(obj)
|
3256 |
+
* @param {mixed} obj
|
3257 |
+
* @trigger hover_node.jstree
|
3258 |
+
*/
|
3259 |
+
hover_node : function (obj) {
|
3260 |
+
obj = this.get_node(obj, true);
|
3261 |
+
if(!obj || !obj.length || obj.children('.jstree-hovered').length) {
|
3262 |
+
return false;
|
3263 |
+
}
|
3264 |
+
var o = this.element.find('.jstree-hovered'), t = this.element;
|
3265 |
+
if(o && o.length) { this.dehover_node(o); }
|
3266 |
+
|
3267 |
+
obj.children('.jstree-anchor').addClass('jstree-hovered');
|
3268 |
+
/**
|
3269 |
+
* triggered when an node is hovered
|
3270 |
+
* @event
|
3271 |
+
* @name hover_node.jstree
|
3272 |
+
* @param {Object} node
|
3273 |
+
*/
|
3274 |
+
this.trigger('hover_node', { 'node' : this.get_node(obj) });
|
3275 |
+
setTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0);
|
3276 |
+
},
|
3277 |
+
/**
|
3278 |
+
* removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally.
|
3279 |
+
* @private
|
3280 |
+
* @name dehover_node(obj)
|
3281 |
+
* @param {mixed} obj
|
3282 |
+
* @trigger dehover_node.jstree
|
3283 |
+
*/
|
3284 |
+
dehover_node : function (obj) {
|
3285 |
+
obj = this.get_node(obj, true);
|
3286 |
+
if(!obj || !obj.length || !obj.children('.jstree-hovered').length) {
|
3287 |
+
return false;
|
3288 |
+
}
|
3289 |
+
obj.children('.jstree-anchor').removeClass('jstree-hovered');
|
3290 |
+
/**
|
3291 |
+
* triggered when an node is no longer hovered
|
3292 |
+
* @event
|
3293 |
+
* @name dehover_node.jstree
|
3294 |
+
* @param {Object} node
|
3295 |
+
*/
|
3296 |
+
this.trigger('dehover_node', { 'node' : this.get_node(obj) });
|
3297 |
+
},
|
3298 |
+
/**
|
3299 |
+
* select a node
|
3300 |
+
* @name select_node(obj [, supress_event, prevent_open])
|
3301 |
+
* @param {mixed} obj an array can be used to select multiple nodes
|
3302 |
+
* @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered
|
3303 |
+
* @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened
|
3304 |
+
* @trigger select_node.jstree, changed.jstree
|
3305 |
+
*/
|
3306 |
+
select_node : function (obj, supress_event, prevent_open, e) {
|
3307 |
+
var dom, t1, t2, th;
|
3308 |
+
if($.isArray(obj)) {
|
3309 |
+
obj = obj.slice();
|
3310 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3311 |
+
this.select_node(obj[t1], supress_event, prevent_open, e);
|
3312 |
+
}
|
3313 |
+
return true;
|
3314 |
+
}
|
3315 |
+
obj = this.get_node(obj);
|
3316 |
+
if(!obj || obj.id === $.jstree.root) {
|
3317 |
+
return false;
|
3318 |
+
}
|
3319 |
+
dom = this.get_node(obj, true);
|
3320 |
+
if(!obj.state.selected) {
|
3321 |
+
obj.state.selected = true;
|
3322 |
+
this._data.core.selected.push(obj.id);
|
3323 |
+
if(!prevent_open) {
|
3324 |
+
dom = this._open_to(obj);
|
3325 |
+
}
|
3326 |
+
if(dom && dom.length) {
|
3327 |
+
dom.attr('aria-selected', true).children('.jstree-anchor').addClass('jstree-clicked').attr('aria-selected', true);
|
3328 |
+
}
|
3329 |
+
/**
|
3330 |
+
* triggered when an node is selected
|
3331 |
+
* @event
|
3332 |
+
* @name select_node.jstree
|
3333 |
+
* @param {Object} node
|
3334 |
+
* @param {Array} selected the current selection
|
3335 |
+
* @param {Object} event the event (if any) that triggered this select_node
|
3336 |
+
*/
|
3337 |
+
this.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });
|
3338 |
+
if(!supress_event) {
|
3339 |
+
/**
|
3340 |
+
* triggered when selection changes
|
3341 |
+
* @event
|
3342 |
+
* @name changed.jstree
|
3343 |
+
* @param {Object} node
|
3344 |
+
* @param {Object} action the action that caused the selection to change
|
3345 |
+
* @param {Array} selected the current selection
|
3346 |
+
* @param {Object} event the event (if any) that triggered this changed event
|
3347 |
+
*/
|
3348 |
+
this.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });
|
3349 |
+
}
|
3350 |
+
}
|
3351 |
+
},
|
3352 |
+
/**
|
3353 |
+
* deselect a node
|
3354 |
+
* @name deselect_node(obj [, supress_event])
|
3355 |
+
* @param {mixed} obj an array can be used to deselect multiple nodes
|
3356 |
+
* @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered
|
3357 |
+
* @trigger deselect_node.jstree, changed.jstree
|
3358 |
+
*/
|
3359 |
+
deselect_node : function (obj, supress_event, e) {
|
3360 |
+
var t1, t2, dom;
|
3361 |
+
if($.isArray(obj)) {
|
3362 |
+
obj = obj.slice();
|
3363 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3364 |
+
this.deselect_node(obj[t1], supress_event, e);
|
3365 |
+
}
|
3366 |
+
return true;
|
3367 |
+
}
|
3368 |
+
obj = this.get_node(obj);
|
3369 |
+
if(!obj || obj.id === $.jstree.root) {
|
3370 |
+
return false;
|
3371 |
+
}
|
3372 |
+
dom = this.get_node(obj, true);
|
3373 |
+
if(obj.state.selected) {
|
3374 |
+
obj.state.selected = false;
|
3375 |
+
this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id);
|
3376 |
+
if(dom.length) {
|
3377 |
+
dom.attr('aria-selected', false).children('.jstree-anchor').removeClass('jstree-clicked').attr('aria-selected', false);
|
3378 |
+
}
|
3379 |
+
/**
|
3380 |
+
* triggered when an node is deselected
|
3381 |
+
* @event
|
3382 |
+
* @name deselect_node.jstree
|
3383 |
+
* @param {Object} node
|
3384 |
+
* @param {Array} selected the current selection
|
3385 |
+
* @param {Object} event the event (if any) that triggered this deselect_node
|
3386 |
+
*/
|
3387 |
+
this.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });
|
3388 |
+
if(!supress_event) {
|
3389 |
+
this.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e });
|
3390 |
+
}
|
3391 |
+
}
|
3392 |
+
},
|
3393 |
+
/**
|
3394 |
+
* select all nodes in the tree
|
3395 |
+
* @name select_all([supress_event])
|
3396 |
+
* @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered
|
3397 |
+
* @trigger select_all.jstree, changed.jstree
|
3398 |
+
*/
|
3399 |
+
select_all : function (supress_event) {
|
3400 |
+
var tmp = this._data.core.selected.concat([]), i, j;
|
3401 |
+
this._data.core.selected = this._model.data[$.jstree.root].children_d.concat();
|
3402 |
+
for(i = 0, j = this._data.core.selected.length; i < j; i++) {
|
3403 |
+
if(this._model.data[this._data.core.selected[i]]) {
|
3404 |
+
this._model.data[this._data.core.selected[i]].state.selected = true;
|
3405 |
+
}
|
3406 |
+
}
|
3407 |
+
this.redraw(true);
|
3408 |
+
/**
|
3409 |
+
* triggered when all nodes are selected
|
3410 |
+
* @event
|
3411 |
+
* @name select_all.jstree
|
3412 |
+
* @param {Array} selected the current selection
|
3413 |
+
*/
|
3414 |
+
this.trigger('select_all', { 'selected' : this._data.core.selected });
|
3415 |
+
if(!supress_event) {
|
3416 |
+
this.trigger('changed', { 'action' : 'select_all', 'selected' : this._data.core.selected, 'old_selection' : tmp });
|
3417 |
+
}
|
3418 |
+
},
|
3419 |
+
/**
|
3420 |
+
* deselect all selected nodes
|
3421 |
+
* @name deselect_all([supress_event])
|
3422 |
+
* @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered
|
3423 |
+
* @trigger deselect_all.jstree, changed.jstree
|
3424 |
+
*/
|
3425 |
+
deselect_all : function (supress_event) {
|
3426 |
+
var tmp = this._data.core.selected.concat([]), i, j;
|
3427 |
+
for(i = 0, j = this._data.core.selected.length; i < j; i++) {
|
3428 |
+
if(this._model.data[this._data.core.selected[i]]) {
|
3429 |
+
this._model.data[this._data.core.selected[i]].state.selected = false;
|
3430 |
+
}
|
3431 |
+
}
|
3432 |
+
this._data.core.selected = [];
|
3433 |
+
this.element.find('.jstree-clicked').removeClass('jstree-clicked').attr('aria-selected', false).parent().attr('aria-selected', false);
|
3434 |
+
/**
|
3435 |
+
* triggered when all nodes are deselected
|
3436 |
+
* @event
|
3437 |
+
* @name deselect_all.jstree
|
3438 |
+
* @param {Object} node the previous selection
|
3439 |
+
* @param {Array} selected the current selection
|
3440 |
+
*/
|
3441 |
+
this.trigger('deselect_all', { 'selected' : this._data.core.selected, 'node' : tmp });
|
3442 |
+
if(!supress_event) {
|
3443 |
+
this.trigger('changed', { 'action' : 'deselect_all', 'selected' : this._data.core.selected, 'old_selection' : tmp });
|
3444 |
+
}
|
3445 |
+
},
|
3446 |
+
/**
|
3447 |
+
* checks if a node is selected
|
3448 |
+
* @name is_selected(obj)
|
3449 |
+
* @param {mixed} obj
|
3450 |
+
* @return {Boolean}
|
3451 |
+
*/
|
3452 |
+
is_selected : function (obj) {
|
3453 |
+
obj = this.get_node(obj);
|
3454 |
+
if(!obj || obj.id === $.jstree.root) {
|
3455 |
+
return false;
|
3456 |
+
}
|
3457 |
+
return obj.state.selected;
|
3458 |
+
},
|
3459 |
+
/**
|
3460 |
+
* get an array of all selected nodes
|
3461 |
+
* @name get_selected([full])
|
3462 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
3463 |
+
* @return {Array}
|
3464 |
+
*/
|
3465 |
+
get_selected : function (full) {
|
3466 |
+
return full ? $.map(this._data.core.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.core.selected.slice();
|
3467 |
+
},
|
3468 |
+
/**
|
3469 |
+
* get an array of all top level selected nodes (ignoring children of selected nodes)
|
3470 |
+
* @name get_top_selected([full])
|
3471 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
3472 |
+
* @return {Array}
|
3473 |
+
*/
|
3474 |
+
get_top_selected : function (full) {
|
3475 |
+
var tmp = this.get_selected(true),
|
3476 |
+
obj = {}, i, j, k, l;
|
3477 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
3478 |
+
obj[tmp[i].id] = tmp[i];
|
3479 |
+
}
|
3480 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
3481 |
+
for(k = 0, l = tmp[i].children_d.length; k < l; k++) {
|
3482 |
+
if(obj[tmp[i].children_d[k]]) {
|
3483 |
+
delete obj[tmp[i].children_d[k]];
|
3484 |
+
}
|
3485 |
+
}
|
3486 |
+
}
|
3487 |
+
tmp = [];
|
3488 |
+
for(i in obj) {
|
3489 |
+
if(obj.hasOwnProperty(i)) {
|
3490 |
+
tmp.push(i);
|
3491 |
+
}
|
3492 |
+
}
|
3493 |
+
return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp;
|
3494 |
+
},
|
3495 |
+
/**
|
3496 |
+
* get an array of all bottom level selected nodes (ignoring selected parents)
|
3497 |
+
* @name get_bottom_selected([full])
|
3498 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
3499 |
+
* @return {Array}
|
3500 |
+
*/
|
3501 |
+
get_bottom_selected : function (full) {
|
3502 |
+
var tmp = this.get_selected(true),
|
3503 |
+
obj = [], i, j;
|
3504 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
3505 |
+
if(!tmp[i].children.length) {
|
3506 |
+
obj.push(tmp[i].id);
|
3507 |
+
}
|
3508 |
+
}
|
3509 |
+
return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj;
|
3510 |
+
},
|
3511 |
+
/**
|
3512 |
+
* gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally.
|
3513 |
+
* @name get_state()
|
3514 |
+
* @private
|
3515 |
+
* @return {Object}
|
3516 |
+
*/
|
3517 |
+
get_state : function () {
|
3518 |
+
var state = {
|
3519 |
+
'core' : {
|
3520 |
+
'open' : [],
|
3521 |
+
'loaded' : [],
|
3522 |
+
'scroll' : {
|
3523 |
+
'left' : this.element.scrollLeft(),
|
3524 |
+
'top' : this.element.scrollTop()
|
3525 |
+
},
|
3526 |
+
/*!
|
3527 |
+
'themes' : {
|
3528 |
+
'name' : this.get_theme(),
|
3529 |
+
'icons' : this._data.core.themes.icons,
|
3530 |
+
'dots' : this._data.core.themes.dots
|
3531 |
+
},
|
3532 |
+
*/
|
3533 |
+
'selected' : []
|
3534 |
+
}
|
3535 |
+
}, i;
|
3536 |
+
for(i in this._model.data) {
|
3537 |
+
if(this._model.data.hasOwnProperty(i)) {
|
3538 |
+
if(i !== $.jstree.root) {
|
3539 |
+
if(this._model.data[i].state.loaded && this.settings.core.loaded_state) {
|
3540 |
+
state.core.loaded.push(i);
|
3541 |
+
}
|
3542 |
+
if(this._model.data[i].state.opened) {
|
3543 |
+
state.core.open.push(i);
|
3544 |
+
}
|
3545 |
+
if(this._model.data[i].state.selected) {
|
3546 |
+
state.core.selected.push(i);
|
3547 |
+
}
|
3548 |
+
}
|
3549 |
+
}
|
3550 |
+
}
|
3551 |
+
return state;
|
3552 |
+
},
|
3553 |
+
/**
|
3554 |
+
* sets the state of the tree. Used internally.
|
3555 |
+
* @name set_state(state [, callback])
|
3556 |
+
* @private
|
3557 |
+
* @param {Object} state the state to restore. Keep in mind this object is passed by reference and jstree will modify it.
|
3558 |
+
* @param {Function} callback an optional function to execute once the state is restored.
|
3559 |
+
* @trigger set_state.jstree
|
3560 |
+
*/
|
3561 |
+
set_state : function (state, callback) {
|
3562 |
+
if(state) {
|
3563 |
+
if(state.core && state.core.selected && state.core.initial_selection === undefined) {
|
3564 |
+
state.core.initial_selection = this._data.core.selected.concat([]).sort().join(',');
|
3565 |
+
}
|
3566 |
+
if(state.core) {
|
3567 |
+
var res, n, t, _this, i;
|
3568 |
+
if(state.core.loaded) {
|
3569 |
+
if(!this.settings.core.loaded_state || !$.isArray(state.core.loaded) || !state.core.loaded.length) {
|
3570 |
+
delete state.core.loaded;
|
3571 |
+
this.set_state(state, callback);
|
3572 |
+
}
|
3573 |
+
else {
|
3574 |
+
this._load_nodes(state.core.loaded, function (nodes) {
|
3575 |
+
delete state.core.loaded;
|
3576 |
+
this.set_state(state, callback);
|
3577 |
+
});
|
3578 |
+
}
|
3579 |
+
return false;
|
3580 |
+
}
|
3581 |
+
if(state.core.open) {
|
3582 |
+
if(!$.isArray(state.core.open) || !state.core.open.length) {
|
3583 |
+
delete state.core.open;
|
3584 |
+
this.set_state(state, callback);
|
3585 |
+
}
|
3586 |
+
else {
|
3587 |
+
this._load_nodes(state.core.open, function (nodes) {
|
3588 |
+
this.open_node(nodes, false, 0);
|
3589 |
+
delete state.core.open;
|
3590 |
+
this.set_state(state, callback);
|
3591 |
+
});
|
3592 |
+
}
|
3593 |
+
return false;
|
3594 |
+
}
|
3595 |
+
if(state.core.scroll) {
|
3596 |
+
if(state.core.scroll && state.core.scroll.left !== undefined) {
|
3597 |
+
this.element.scrollLeft(state.core.scroll.left);
|
3598 |
+
}
|
3599 |
+
if(state.core.scroll && state.core.scroll.top !== undefined) {
|
3600 |
+
this.element.scrollTop(state.core.scroll.top);
|
3601 |
+
}
|
3602 |
+
delete state.core.scroll;
|
3603 |
+
this.set_state(state, callback);
|
3604 |
+
return false;
|
3605 |
+
}
|
3606 |
+
if(state.core.selected) {
|
3607 |
+
_this = this;
|
3608 |
+
if (state.core.initial_selection === undefined ||
|
3609 |
+
state.core.initial_selection === this._data.core.selected.concat([]).sort().join(',')
|
3610 |
+
) {
|
3611 |
+
this.deselect_all();
|
3612 |
+
$.each(state.core.selected, function (i, v) {
|
3613 |
+
_this.select_node(v, false, true);
|
3614 |
+
});
|
3615 |
+
}
|
3616 |
+
delete state.core.initial_selection;
|
3617 |
+
delete state.core.selected;
|
3618 |
+
this.set_state(state, callback);
|
3619 |
+
return false;
|
3620 |
+
}
|
3621 |
+
for(i in state) {
|
3622 |
+
if(state.hasOwnProperty(i) && i !== "core" && $.inArray(i, this.settings.plugins) === -1) {
|
3623 |
+
delete state[i];
|
3624 |
+
}
|
3625 |
+
}
|
3626 |
+
if($.isEmptyObject(state.core)) {
|
3627 |
+
delete state.core;
|
3628 |
+
this.set_state(state, callback);
|
3629 |
+
return false;
|
3630 |
+
}
|
3631 |
+
}
|
3632 |
+
if($.isEmptyObject(state)) {
|
3633 |
+
state = null;
|
3634 |
+
if(callback) { callback.call(this); }
|
3635 |
+
/**
|
3636 |
+
* triggered when a `set_state` call completes
|
3637 |
+
* @event
|
3638 |
+
* @name set_state.jstree
|
3639 |
+
*/
|
3640 |
+
this.trigger('set_state');
|
3641 |
+
return false;
|
3642 |
+
}
|
3643 |
+
return true;
|
3644 |
+
}
|
3645 |
+
return false;
|
3646 |
+
},
|
3647 |
+
/**
|
3648 |
+
* refreshes the tree - all nodes are reloaded with calls to `load_node`.
|
3649 |
+
* @name refresh()
|
3650 |
+
* @param {Boolean} skip_loading an option to skip showing the loading indicator
|
3651 |
+
* @param {Mixed} forget_state if set to `true` state will not be reapplied, if set to a function (receiving the current state as argument) the result of that function will be used as state
|
3652 |
+
* @trigger refresh.jstree
|
3653 |
+
*/
|
3654 |
+
refresh : function (skip_loading, forget_state) {
|
3655 |
+
this._data.core.state = forget_state === true ? {} : this.get_state();
|
3656 |
+
if(forget_state && $.isFunction(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); }
|
3657 |
+
this._cnt = 0;
|
3658 |
+
this._model.data = {};
|
3659 |
+
this._model.data[$.jstree.root] = {
|
3660 |
+
id : $.jstree.root,
|
3661 |
+
parent : null,
|
3662 |
+
parents : [],
|
3663 |
+
children : [],
|
3664 |
+
children_d : [],
|
3665 |
+
state : { loaded : false }
|
3666 |
+
};
|
3667 |
+
this._data.core.selected = [];
|
3668 |
+
this._data.core.last_clicked = null;
|
3669 |
+
this._data.core.focused = null;
|
3670 |
+
|
3671 |
+
var c = this.get_container_ul()[0].className;
|
3672 |
+
if(!skip_loading) {
|
3673 |
+
this.element.html("<"+"ul class='"+c+"' role='group'><"+"li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='presentation' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><"+"a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden pfolder-folder-close'></i>" + this.get_string("Loading ...") + "</a></li></ul>");
|
3674 |
+
this.element.attr('aria-activedescendant','j'+this._id+'_loading');
|
3675 |
+
}
|
3676 |
+
this.load_node($.jstree.root, function (o, s) {
|
3677 |
+
if(s) {
|
3678 |
+
this.get_container_ul()[0].className = c;
|
3679 |
+
if(this._firstChild(this.get_container_ul()[0])) {
|
3680 |
+
this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id);
|
3681 |
+
}
|
3682 |
+
this.set_state($.extend(true, {}, this._data.core.state), function () {
|
3683 |
+
/**
|
3684 |
+
* triggered when a `refresh` call completes
|
3685 |
+
* @event
|
3686 |
+
* @name refresh.jstree
|
3687 |
+
*/
|
3688 |
+
this.trigger('refresh');
|
3689 |
+
});
|
3690 |
+
}
|
3691 |
+
this._data.core.state = null;
|
3692 |
+
});
|
3693 |
+
},
|
3694 |
+
/**
|
3695 |
+
* refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`.
|
3696 |
+
* @name refresh_node(obj)
|
3697 |
+
* @param {mixed} obj the node
|
3698 |
+
* @trigger refresh_node.jstree
|
3699 |
+
*/
|
3700 |
+
refresh_node : function (obj) {
|
3701 |
+
obj = this.get_node(obj);
|
3702 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
3703 |
+
var opened = [], to_load = [], s = this._data.core.selected.concat([]);
|
3704 |
+
to_load.push(obj.id);
|
3705 |
+
if(obj.state.opened === true) { opened.push(obj.id); }
|
3706 |
+
this.get_node(obj, true).find('.jstree-open').each(function() { to_load.push(this.id); opened.push(this.id); });
|
3707 |
+
this._load_nodes(to_load, $.proxy(function (nodes) {
|
3708 |
+
this.open_node(opened, false, 0);
|
3709 |
+
this.select_node(s);
|
3710 |
+
/**
|
3711 |
+
* triggered when a node is refreshed
|
3712 |
+
* @event
|
3713 |
+
* @name refresh_node.jstree
|
3714 |
+
* @param {Object} node - the refreshed node
|
3715 |
+
* @param {Array} nodes - an array of the IDs of the nodes that were reloaded
|
3716 |
+
*/
|
3717 |
+
this.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes });
|
3718 |
+
}, this), false, true);
|
3719 |
+
},
|
3720 |
+
/**
|
3721 |
+
* set (change) the ID of a node
|
3722 |
+
* @name set_id(obj, id)
|
3723 |
+
* @param {mixed} obj the node
|
3724 |
+
* @param {String} id the new ID
|
3725 |
+
* @return {Boolean}
|
3726 |
+
* @trigger set_id.jstree
|
3727 |
+
*/
|
3728 |
+
set_id : function (obj, id) {
|
3729 |
+
obj = this.get_node(obj);
|
3730 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
3731 |
+
var i, j, m = this._model.data, old = obj.id;
|
3732 |
+
id = id.toString();
|
3733 |
+
// update parents (replace current ID with new one in children and children_d)
|
3734 |
+
m[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id;
|
3735 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
3736 |
+
m[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id;
|
3737 |
+
}
|
3738 |
+
// update children (replace current ID with new one in parent and parents)
|
3739 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
3740 |
+
m[obj.children[i]].parent = id;
|
3741 |
+
}
|
3742 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
3743 |
+
m[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id;
|
3744 |
+
}
|
3745 |
+
i = $.inArray(obj.id, this._data.core.selected);
|
3746 |
+
if(i !== -1) { this._data.core.selected[i] = id; }
|
3747 |
+
// update model and obj itself (obj.id, this._model.data[KEY])
|
3748 |
+
i = this.get_node(obj.id, true);
|
3749 |
+
if(i) {
|
3750 |
+
i.attr('id', id); //.children('.jstree-anchor').attr('id', id + '_anchor').end().attr('aria-labelledby', id + '_anchor');
|
3751 |
+
if(this.element.attr('aria-activedescendant') === obj.id) {
|
3752 |
+
this.element.attr('aria-activedescendant', id);
|
3753 |
+
}
|
3754 |
+
}
|
3755 |
+
delete m[obj.id];
|
3756 |
+
obj.id = id;
|
3757 |
+
obj.li_attr.id = id;
|
3758 |
+
m[id] = obj;
|
3759 |
+
/**
|
3760 |
+
* triggered when a node id value is changed
|
3761 |
+
* @event
|
3762 |
+
* @name set_id.jstree
|
3763 |
+
* @param {Object} node
|
3764 |
+
* @param {String} old the old id
|
3765 |
+
*/
|
3766 |
+
this.trigger('set_id',{ "node" : obj, "new" : obj.id, "old" : old });
|
3767 |
+
return true;
|
3768 |
+
},
|
3769 |
+
/**
|
3770 |
+
* get the text value of a node
|
3771 |
+
* @name get_text(obj)
|
3772 |
+
* @param {mixed} obj the node
|
3773 |
+
* @return {String}
|
3774 |
+
*/
|
3775 |
+
get_text : function (obj) {
|
3776 |
+
obj = this.get_node(obj);
|
3777 |
+
return (!obj || obj.id === $.jstree.root) ? false : obj.text;
|
3778 |
+
},
|
3779 |
+
/**
|
3780 |
+
* set the text value of a node. Used internally, please use `rename_node(obj, val)`.
|
3781 |
+
* @private
|
3782 |
+
* @name set_text(obj, val)
|
3783 |
+
* @param {mixed} obj the node, you can pass an array to set the text on multiple nodes
|
3784 |
+
* @param {String} val the new text value
|
3785 |
+
* @return {Boolean}
|
3786 |
+
* @trigger set_text.jstree
|
3787 |
+
*/
|
3788 |
+
set_text : function (obj, val) {
|
3789 |
+
var t1, t2;
|
3790 |
+
if($.isArray(obj)) {
|
3791 |
+
obj = obj.slice();
|
3792 |
+
console.log(obj);
|
3793 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3794 |
+
this.set_text(obj[t1], val);
|
3795 |
+
}
|
3796 |
+
return true;
|
3797 |
+
}
|
3798 |
+
obj = this.get_node(obj);
|
3799 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
3800 |
+
obj.text = val;
|
3801 |
+
if(this.get_node(obj, true).length) {
|
3802 |
+
this.redraw_node(obj.id);
|
3803 |
+
}
|
3804 |
+
/**
|
3805 |
+
* triggered when a node text value is changed
|
3806 |
+
* @event
|
3807 |
+
* @name set_text.jstree
|
3808 |
+
* @param {Object} obj
|
3809 |
+
* @param {String} text the new value
|
3810 |
+
*/
|
3811 |
+
this.trigger('set_text',{ "obj" : obj, "text" : val });
|
3812 |
+
return true;
|
3813 |
+
},
|
3814 |
+
/**
|
3815 |
+
* gets a JSON representation of a node (or the whole tree)
|
3816 |
+
* @name get_json([obj, options])
|
3817 |
+
* @param {mixed} obj
|
3818 |
+
* @param {Object} options
|
3819 |
+
* @param {Boolean} options.no_state do not return state information
|
3820 |
+
* @param {Boolean} options.no_id do not return ID
|
3821 |
+
* @param {Boolean} options.no_children do not include children
|
3822 |
+
* @param {Boolean} options.no_data do not include node data
|
3823 |
+
* @param {Boolean} options.no_li_attr do not include LI attributes
|
3824 |
+
* @param {Boolean} options.no_a_attr do not include A attributes
|
3825 |
+
* @param {Boolean} options.flat return flat JSON instead of nested
|
3826 |
+
* @return {Object}
|
3827 |
+
*/
|
3828 |
+
get_json : function (obj, options, flat) {
|
3829 |
+
obj = this.get_node(obj || $.jstree.root);
|
3830 |
+
if(!obj) { return false; }
|
3831 |
+
if(options && options.flat && !flat) { flat = []; }
|
3832 |
+
var tmp = {
|
3833 |
+
'id' : obj.id,
|
3834 |
+
'text' : obj.text,
|
3835 |
+
'icon' : this.get_icon(obj),
|
3836 |
+
'li_attr' : $.extend(true, {}, obj.li_attr),
|
3837 |
+
'a_attr' : $.extend(true, {}, obj.a_attr),
|
3838 |
+
'state' : {},
|
3839 |
+
'data' : options && options.no_data ? false : $.extend(true, $.isArray(obj.data)?[]:{}, obj.data)
|
3840 |
+
//( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ),
|
3841 |
+
}, i, j;
|
3842 |
+
if(options && options.flat) {
|
3843 |
+
tmp.parent = obj.parent;
|
3844 |
+
}
|
3845 |
+
else {
|
3846 |
+
tmp.children = [];
|
3847 |
+
}
|
3848 |
+
if(!options || !options.no_state) {
|
3849 |
+
for(i in obj.state) {
|
3850 |
+
if(obj.state.hasOwnProperty(i)) {
|
3851 |
+
tmp.state[i] = obj.state[i];
|
3852 |
+
}
|
3853 |
+
}
|
3854 |
+
} else {
|
3855 |
+
delete tmp.state;
|
3856 |
+
}
|
3857 |
+
if(options && options.no_li_attr) {
|
3858 |
+
delete tmp.li_attr;
|
3859 |
+
}
|
3860 |
+
if(options && options.no_a_attr) {
|
3861 |
+
delete tmp.a_attr;
|
3862 |
+
}
|
3863 |
+
if(options && options.no_id) {
|
3864 |
+
delete tmp.id;
|
3865 |
+
if(tmp.li_attr && tmp.li_attr.id) {
|
3866 |
+
delete tmp.li_attr.id;
|
3867 |
+
}
|
3868 |
+
if(tmp.a_attr && tmp.a_attr.id) {
|
3869 |
+
delete tmp.a_attr.id;
|
3870 |
+
}
|
3871 |
+
}
|
3872 |
+
if(options && options.flat && obj.id !== $.jstree.root) {
|
3873 |
+
flat.push(tmp);
|
3874 |
+
}
|
3875 |
+
if(!options || !options.no_children) {
|
3876 |
+
for(i = 0, j = obj.children.length; i < j; i++) {
|
3877 |
+
if(options && options.flat) {
|
3878 |
+
this.get_json(obj.children[i], options, flat);
|
3879 |
+
}
|
3880 |
+
else {
|
3881 |
+
tmp.children.push(this.get_json(obj.children[i], options));
|
3882 |
+
}
|
3883 |
+
}
|
3884 |
+
}
|
3885 |
+
return options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp);
|
3886 |
+
},
|
3887 |
+
/**
|
3888 |
+
* create a new node (do not confuse with load_node)
|
3889 |
+
* @name create_node([par, node, pos, callback, is_loaded])
|
3890 |
+
* @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`)
|
3891 |
+
* @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name)
|
3892 |
+
* @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last"
|
3893 |
+
* @param {Function} callback a function to be called once the node is created
|
3894 |
+
* @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded
|
3895 |
+
* @return {String} the ID of the newly create node
|
3896 |
+
* @trigger model.jstree, create_node.jstree
|
3897 |
+
*/
|
3898 |
+
create_node : function (par, node, pos, callback, is_loaded) {
|
3899 |
+
if(par === null) { par = $.jstree.root; }
|
3900 |
+
par = this.get_node(par);
|
3901 |
+
if(!par) { return false; }
|
3902 |
+
pos = pos === undefined ? "last" : pos;
|
3903 |
+
if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
|
3904 |
+
return this.load_node(par, function () { this.create_node(par, node, pos, callback, true); });
|
3905 |
+
}
|
3906 |
+
if(!node) { node = { "text" : this.get_string('New node') }; }
|
3907 |
+
if(typeof node === "string") {
|
3908 |
+
node = { "text" : node };
|
3909 |
+
} else {
|
3910 |
+
node = $.extend(true, {}, node);
|
3911 |
+
}
|
3912 |
+
if(node.text === undefined) { node.text = this.get_string('New node'); }
|
3913 |
+
var tmp, dpc, i, j;
|
3914 |
+
|
3915 |
+
if(par.id === $.jstree.root) {
|
3916 |
+
if(pos === "before") { pos = "first"; }
|
3917 |
+
if(pos === "after") { pos = "last"; }
|
3918 |
+
}
|
3919 |
+
switch(pos) {
|
3920 |
+
case "before":
|
3921 |
+
tmp = this.get_node(par.parent);
|
3922 |
+
pos = $.inArray(par.id, tmp.children);
|
3923 |
+
par = tmp;
|
3924 |
+
break;
|
3925 |
+
case "after" :
|
3926 |
+
tmp = this.get_node(par.parent);
|
3927 |
+
pos = $.inArray(par.id, tmp.children) + 1;
|
3928 |
+
par = tmp;
|
3929 |
+
break;
|
3930 |
+
case "inside":
|
3931 |
+
case "first":
|
3932 |
+
pos = 0;
|
3933 |
+
break;
|
3934 |
+
case "last":
|
3935 |
+
pos = par.children.length;
|
3936 |
+
break;
|
3937 |
+
default:
|
3938 |
+
if(!pos) { pos = 0; }
|
3939 |
+
break;
|
3940 |
+
}
|
3941 |
+
if(pos > par.children.length) { pos = par.children.length; }
|
3942 |
+
if(!node.id) { node.id = true; }
|
3943 |
+
if(!this.check("create_node", node, par, pos)) {
|
3944 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
3945 |
+
return false;
|
3946 |
+
}
|
3947 |
+
if(node.id === true) { delete node.id; }
|
3948 |
+
node = this._parse_model_from_json(node, par.id, par.parents.concat());
|
3949 |
+
if(!node) { return false; }
|
3950 |
+
tmp = this.get_node(node);
|
3951 |
+
dpc = [];
|
3952 |
+
dpc.push(node);
|
3953 |
+
dpc = dpc.concat(tmp.children_d);
|
3954 |
+
this.trigger('model', { "nodes" : dpc, "parent" : par.id });
|
3955 |
+
|
3956 |
+
par.children_d = par.children_d.concat(dpc);
|
3957 |
+
for(i = 0, j = par.parents.length; i < j; i++) {
|
3958 |
+
this._model.data[par.parents[i]].children_d = this._model.data[par.parents[i]].children_d.concat(dpc);
|
3959 |
+
}
|
3960 |
+
node = tmp;
|
3961 |
+
tmp = [];
|
3962 |
+
for(i = 0, j = par.children.length; i < j; i++) {
|
3963 |
+
tmp[i >= pos ? i+1 : i] = par.children[i];
|
3964 |
+
}
|
3965 |
+
tmp[pos] = node.id;
|
3966 |
+
par.children = tmp;
|
3967 |
+
|
3968 |
+
this.redraw_node(par, true);
|
3969 |
+
/**
|
3970 |
+
* triggered when a node is created
|
3971 |
+
* @event
|
3972 |
+
* @name create_node.jstree
|
3973 |
+
* @param {Object} node
|
3974 |
+
* @param {String} parent the parent's ID
|
3975 |
+
* @param {Number} position the position of the new node among the parent's children
|
3976 |
+
*/
|
3977 |
+
this.trigger('create_node', { "node" : this.get_node(node), "parent" : par.id, "position" : pos });
|
3978 |
+
if(callback) { callback.call(this, this.get_node(node)); }
|
3979 |
+
return node.id;
|
3980 |
+
},
|
3981 |
+
/**
|
3982 |
+
* set the text value of a node
|
3983 |
+
* @name rename_node(obj, val)
|
3984 |
+
* @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name
|
3985 |
+
* @param {String} val the new text value
|
3986 |
+
* @return {Boolean}
|
3987 |
+
* @trigger rename_node.jstree
|
3988 |
+
*/
|
3989 |
+
rename_node : function (obj, val) {
|
3990 |
+
var t1, t2, old;
|
3991 |
+
if($.isArray(obj)) {
|
3992 |
+
obj = obj.slice();
|
3993 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
3994 |
+
this.rename_node(obj[t1], val);
|
3995 |
+
}
|
3996 |
+
return true;
|
3997 |
+
}
|
3998 |
+
obj = this.get_node(obj);
|
3999 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
4000 |
+
old = obj.text;
|
4001 |
+
if(!this.check("rename_node", obj, this.get_parent(obj), val)) {
|
4002 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
4003 |
+
return false;
|
4004 |
+
}
|
4005 |
+
this.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments))
|
4006 |
+
/**
|
4007 |
+
* triggered when a node is renamed
|
4008 |
+
* @event
|
4009 |
+
* @name rename_node.jstree
|
4010 |
+
* @param {Object} node
|
4011 |
+
* @param {String} text the new value
|
4012 |
+
* @param {String} old the old value
|
4013 |
+
*/
|
4014 |
+
this.trigger('rename_node', { "node" : obj, "text" : val, "old" : old });
|
4015 |
+
return true;
|
4016 |
+
},
|
4017 |
+
/**
|
4018 |
+
* remove a node
|
4019 |
+
* @name delete_node(obj)
|
4020 |
+
* @param {mixed} obj the node, you can pass an array to delete multiple nodes
|
4021 |
+
* @return {Boolean}
|
4022 |
+
* @trigger delete_node.jstree, changed.jstree
|
4023 |
+
*/
|
4024 |
+
delete_node : function (obj) {
|
4025 |
+
var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft;
|
4026 |
+
if($.isArray(obj)) {
|
4027 |
+
obj = obj.slice();
|
4028 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4029 |
+
this.delete_node(obj[t1]);
|
4030 |
+
}
|
4031 |
+
return true;
|
4032 |
+
}
|
4033 |
+
obj = this.get_node(obj);
|
4034 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
4035 |
+
par = this.get_node(obj.parent);
|
4036 |
+
pos = $.inArray(obj.id, par.children);
|
4037 |
+
c = false;
|
4038 |
+
if(!this.check("delete_node", obj, par, pos)) {
|
4039 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
4040 |
+
return false;
|
4041 |
+
}
|
4042 |
+
if(pos !== -1) {
|
4043 |
+
par.children = $.vakata.array_remove(par.children, pos);
|
4044 |
+
}
|
4045 |
+
tmp = obj.children_d.concat([]);
|
4046 |
+
tmp.push(obj.id);
|
4047 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
4048 |
+
this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) {
|
4049 |
+
return $.inArray(v, tmp) === -1;
|
4050 |
+
});
|
4051 |
+
}
|
4052 |
+
for(k = 0, l = tmp.length; k < l; k++) {
|
4053 |
+
if(this._model.data[tmp[k]].state.selected) {
|
4054 |
+
c = true;
|
4055 |
+
break;
|
4056 |
+
}
|
4057 |
+
}
|
4058 |
+
if (c) {
|
4059 |
+
this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) {
|
4060 |
+
return $.inArray(v, tmp) === -1;
|
4061 |
+
});
|
4062 |
+
}
|
4063 |
+
/**
|
4064 |
+
* triggered when a node is deleted
|
4065 |
+
* @event
|
4066 |
+
* @name delete_node.jstree
|
4067 |
+
* @param {Object} node
|
4068 |
+
* @param {String} parent the parent's ID
|
4069 |
+
*/
|
4070 |
+
this.trigger('delete_node', { "node" : obj, "parent" : par.id });
|
4071 |
+
if(c) {
|
4072 |
+
this.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.selected, 'parent' : par.id });
|
4073 |
+
}
|
4074 |
+
for(k = 0, l = tmp.length; k < l; k++) {
|
4075 |
+
delete this._model.data[tmp[k]];
|
4076 |
+
}
|
4077 |
+
if($.inArray(this._data.core.focused, tmp) !== -1) {
|
4078 |
+
this._data.core.focused = null;
|
4079 |
+
top = this.element[0].scrollTop;
|
4080 |
+
lft = this.element[0].scrollLeft;
|
4081 |
+
if(par.id === $.jstree.root) {
|
4082 |
+
if (this._model.data[$.jstree.root].children[0]) {
|
4083 |
+
this.get_node(this._model.data[$.jstree.root].children[0], true).children('.jstree-anchor').focus();
|
4084 |
+
}
|
4085 |
+
}
|
4086 |
+
else {
|
4087 |
+
this.get_node(par, true).children('.jstree-anchor').focus();
|
4088 |
+
}
|
4089 |
+
this.element[0].scrollTop = top;
|
4090 |
+
this.element[0].scrollLeft = lft;
|
4091 |
+
}
|
4092 |
+
this.redraw_node(par, true);
|
4093 |
+
return true;
|
4094 |
+
},
|
4095 |
+
/**
|
4096 |
+
* check if an operation is premitted on the tree. Used internally.
|
4097 |
+
* @private
|
4098 |
+
* @name check(chk, obj, par, pos)
|
4099 |
+
* @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node"
|
4100 |
+
* @param {mixed} obj the node
|
4101 |
+
* @param {mixed} par the parent
|
4102 |
+
* @param {mixed} pos the position to insert at, or if "rename_node" - the new name
|
4103 |
+
* @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node
|
4104 |
+
* @return {Boolean}
|
4105 |
+
*/
|
4106 |
+
check : function (chk, obj, par, pos, more) {
|
4107 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
4108 |
+
par = par && par.id ? par : this.get_node(par);
|
4109 |
+
var tmp = chk.match(/^move_node|copy_node|create_node$/i) ? par : obj,
|
4110 |
+
chc = this.settings.core.check_callback;
|
4111 |
+
if(chk === "move_node" || chk === "copy_node") {
|
4112 |
+
if((!more || !more.is_multi) && (chk === "move_node" && $.inArray(obj.id, par.children) === pos)) {
|
4113 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_08', 'reason' : 'Moving node to its current position', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
4114 |
+
return false;
|
4115 |
+
}
|
4116 |
+
if((!more || !more.is_multi) && (obj.id === par.id || (chk === "move_node" && $.inArray(obj.id, par.children) === pos) || $.inArray(par.id, obj.children_d) !== -1)) {
|
4117 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_01', 'reason' : 'Moving parent inside child', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
4118 |
+
return false;
|
4119 |
+
}
|
4120 |
+
}
|
4121 |
+
if(tmp && tmp.data) { tmp = tmp.data; }
|
4122 |
+
if(tmp && tmp.functions && (tmp.functions[chk] === false || tmp.functions[chk] === true)) {
|
4123 |
+
if(tmp.functions[chk] === false) {
|
4124 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_02', 'reason' : 'Node data prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
4125 |
+
}
|
4126 |
+
return tmp.functions[chk];
|
4127 |
+
}
|
4128 |
+
if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) {
|
4129 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
4130 |
+
return false;
|
4131 |
+
}
|
4132 |
+
return true;
|
4133 |
+
},
|
4134 |
+
/**
|
4135 |
+
* get the last error
|
4136 |
+
* @name last_error()
|
4137 |
+
* @return {Object}
|
4138 |
+
*/
|
4139 |
+
last_error : function () {
|
4140 |
+
return this._data.core.last_error;
|
4141 |
+
},
|
4142 |
+
/**
|
4143 |
+
* move a node to a new parent
|
4144 |
+
* @name move_node(obj, par [, pos, callback, is_loaded])
|
4145 |
+
* @param {mixed} obj the node to move, pass an array to move multiple nodes
|
4146 |
+
* @param {mixed} par the new parent
|
4147 |
+
* @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0`
|
4148 |
+
* @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position
|
4149 |
+
* @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded
|
4150 |
+
* @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn
|
4151 |
+
* @param {Boolean} instance internal parameter indicating if the node comes from another instance
|
4152 |
+
* @trigger move_node.jstree
|
4153 |
+
*/
|
4154 |
+
move_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) {
|
4155 |
+
var t1, t2, old_par, old_pos, new_par, old_ins, is_multi, dpc, tmp, i, j, k, l, p;
|
4156 |
+
|
4157 |
+
par = this.get_node(par);
|
4158 |
+
pos = pos === undefined ? 0 : pos;
|
4159 |
+
if(!par) { return false; }
|
4160 |
+
if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
|
4161 |
+
return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); });
|
4162 |
+
}
|
4163 |
+
|
4164 |
+
if($.isArray(obj)) {
|
4165 |
+
if(obj.length === 1) {
|
4166 |
+
obj = obj[0];
|
4167 |
+
}
|
4168 |
+
else {
|
4169 |
+
//obj = obj.slice();
|
4170 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4171 |
+
if((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) {
|
4172 |
+
par = tmp;
|
4173 |
+
pos = "after";
|
4174 |
+
}
|
4175 |
+
}
|
4176 |
+
this.redraw();
|
4177 |
+
return true;
|
4178 |
+
}
|
4179 |
+
}
|
4180 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
4181 |
+
|
4182 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
4183 |
+
|
4184 |
+
old_par = (obj.parent || $.jstree.root).toString();
|
4185 |
+
new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent);
|
4186 |
+
old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));
|
4187 |
+
is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id);
|
4188 |
+
old_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1;
|
4189 |
+
if(old_ins && old_ins._id) {
|
4190 |
+
obj = old_ins._model.data[obj.id];
|
4191 |
+
}
|
4192 |
+
|
4193 |
+
if(is_multi) {
|
4194 |
+
if((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) {
|
4195 |
+
if(old_ins) { old_ins.delete_node(obj); }
|
4196 |
+
return tmp;
|
4197 |
+
}
|
4198 |
+
return false;
|
4199 |
+
}
|
4200 |
+
//var m = this._model.data;
|
4201 |
+
if(par.id === $.jstree.root) {
|
4202 |
+
if(pos === "before") { pos = "first"; }
|
4203 |
+
if(pos === "after") { pos = "last"; }
|
4204 |
+
}
|
4205 |
+
switch(pos) {
|
4206 |
+
case "before":
|
4207 |
+
pos = $.inArray(par.id, new_par.children);
|
4208 |
+
break;
|
4209 |
+
case "after" :
|
4210 |
+
pos = $.inArray(par.id, new_par.children) + 1;
|
4211 |
+
break;
|
4212 |
+
case "inside":
|
4213 |
+
case "first":
|
4214 |
+
pos = 0;
|
4215 |
+
break;
|
4216 |
+
case "last":
|
4217 |
+
pos = new_par.children.length;
|
4218 |
+
break;
|
4219 |
+
default:
|
4220 |
+
if(!pos) { pos = 0; }
|
4221 |
+
break;
|
4222 |
+
}
|
4223 |
+
if(pos > new_par.children.length) { pos = new_par.children.length; }
|
4224 |
+
if(!this.check("move_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) {
|
4225 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
4226 |
+
return false;
|
4227 |
+
}
|
4228 |
+
if(obj.parent === new_par.id) {
|
4229 |
+
dpc = new_par.children.concat();
|
4230 |
+
tmp = $.inArray(obj.id, dpc);
|
4231 |
+
if(tmp !== -1) {
|
4232 |
+
dpc = $.vakata.array_remove(dpc, tmp);
|
4233 |
+
if(pos > tmp) { pos--; }
|
4234 |
+
}
|
4235 |
+
tmp = [];
|
4236 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
4237 |
+
tmp[i >= pos ? i+1 : i] = dpc[i];
|
4238 |
+
}
|
4239 |
+
tmp[pos] = obj.id;
|
4240 |
+
new_par.children = tmp;
|
4241 |
+
this._node_changed(new_par.id);
|
4242 |
+
this.redraw(new_par.id === $.jstree.root);
|
4243 |
+
}
|
4244 |
+
else {
|
4245 |
+
// clean old parent and up
|
4246 |
+
tmp = obj.children_d.concat();
|
4247 |
+
tmp.push(obj.id);
|
4248 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
4249 |
+
dpc = [];
|
4250 |
+
p = old_ins._model.data[obj.parents[i]].children_d;
|
4251 |
+
for(k = 0, l = p.length; k < l; k++) {
|
4252 |
+
if($.inArray(p[k], tmp) === -1) {
|
4253 |
+
dpc.push(p[k]);
|
4254 |
+
}
|
4255 |
+
}
|
4256 |
+
old_ins._model.data[obj.parents[i]].children_d = dpc;
|
4257 |
+
}
|
4258 |
+
old_ins._model.data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id);
|
4259 |
+
|
4260 |
+
// insert into new parent and up
|
4261 |
+
for(i = 0, j = new_par.parents.length; i < j; i++) {
|
4262 |
+
this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(tmp);
|
4263 |
+
}
|
4264 |
+
dpc = [];
|
4265 |
+
for(i = 0, j = new_par.children.length; i < j; i++) {
|
4266 |
+
dpc[i >= pos ? i+1 : i] = new_par.children[i];
|
4267 |
+
}
|
4268 |
+
dpc[pos] = obj.id;
|
4269 |
+
new_par.children = dpc;
|
4270 |
+
new_par.children_d.push(obj.id);
|
4271 |
+
new_par.children_d = new_par.children_d.concat(obj.children_d);
|
4272 |
+
|
4273 |
+
// update object
|
4274 |
+
obj.parent = new_par.id;
|
4275 |
+
tmp = new_par.parents.concat();
|
4276 |
+
tmp.unshift(new_par.id);
|
4277 |
+
p = obj.parents.length;
|
4278 |
+
obj.parents = tmp;
|
4279 |
+
|
4280 |
+
// update object children
|
4281 |
+
tmp = tmp.concat();
|
4282 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
4283 |
+
this._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,p*-1);
|
4284 |
+
Array.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp);
|
4285 |
+
}
|
4286 |
+
|
4287 |
+
if(old_par === $.jstree.root || new_par.id === $.jstree.root) {
|
4288 |
+
this._model.force_full_redraw = true;
|
4289 |
+
}
|
4290 |
+
if(!this._model.force_full_redraw) {
|
4291 |
+
this._node_changed(old_par);
|
4292 |
+
this._node_changed(new_par.id);
|
4293 |
+
}
|
4294 |
+
if(!skip_redraw) {
|
4295 |
+
this.redraw();
|
4296 |
+
}
|
4297 |
+
}
|
4298 |
+
if(callback) { callback.call(this, obj, new_par, pos); }
|
4299 |
+
/**
|
4300 |
+
* triggered when a node is moved
|
4301 |
+
* @event
|
4302 |
+
* @name move_node.jstree
|
4303 |
+
* @param {Object} node
|
4304 |
+
* @param {String} parent the parent's ID
|
4305 |
+
* @param {Number} position the position of the node among the parent's children
|
4306 |
+
* @param {String} old_parent the old parent of the node
|
4307 |
+
* @param {Number} old_position the old position of the node
|
4308 |
+
* @param {Boolean} is_multi do the node and new parent belong to different instances
|
4309 |
+
* @param {jsTree} old_instance the instance the node came from
|
4310 |
+
* @param {jsTree} new_instance the instance of the new parent
|
4311 |
+
*/
|
4312 |
+
this.trigger('move_node', { "node" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_pos, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this });
|
4313 |
+
return obj.id;
|
4314 |
+
},
|
4315 |
+
/**
|
4316 |
+
* copy a node to a new parent
|
4317 |
+
* @name copy_node(obj, par [, pos, callback, is_loaded])
|
4318 |
+
* @param {mixed} obj the node to copy, pass an array to copy multiple nodes
|
4319 |
+
* @param {mixed} par the new parent
|
4320 |
+
* @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0`
|
4321 |
+
* @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position
|
4322 |
+
* @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded
|
4323 |
+
* @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn
|
4324 |
+
* @param {Boolean} instance internal parameter indicating if the node comes from another instance
|
4325 |
+
* @trigger model.jstree copy_node.jstree
|
4326 |
+
*/
|
4327 |
+
copy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) {
|
4328 |
+
var t1, t2, dpc, tmp, i, j, node, old_par, new_par, old_ins, is_multi;
|
4329 |
+
|
4330 |
+
par = this.get_node(par);
|
4331 |
+
pos = pos === undefined ? 0 : pos;
|
4332 |
+
if(!par) { return false; }
|
4333 |
+
if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
|
4334 |
+
return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); });
|
4335 |
+
}
|
4336 |
+
|
4337 |
+
if($.isArray(obj)) {
|
4338 |
+
if(obj.length === 1) {
|
4339 |
+
obj = obj[0];
|
4340 |
+
}
|
4341 |
+
else {
|
4342 |
+
//obj = obj.slice();
|
4343 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4344 |
+
if((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) {
|
4345 |
+
par = tmp;
|
4346 |
+
pos = "after";
|
4347 |
+
}
|
4348 |
+
}
|
4349 |
+
this.redraw();
|
4350 |
+
return true;
|
4351 |
+
}
|
4352 |
+
}
|
4353 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
4354 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
4355 |
+
|
4356 |
+
old_par = (obj.parent || $.jstree.root).toString();
|
4357 |
+
new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent);
|
4358 |
+
old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id));
|
4359 |
+
is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id);
|
4360 |
+
|
4361 |
+
if(old_ins && old_ins._id) {
|
4362 |
+
obj = old_ins._model.data[obj.id];
|
4363 |
+
}
|
4364 |
+
|
4365 |
+
if(par.id === $.jstree.root) {
|
4366 |
+
if(pos === "before") { pos = "first"; }
|
4367 |
+
if(pos === "after") { pos = "last"; }
|
4368 |
+
}
|
4369 |
+
switch(pos) {
|
4370 |
+
case "before":
|
4371 |
+
pos = $.inArray(par.id, new_par.children);
|
4372 |
+
break;
|
4373 |
+
case "after" :
|
4374 |
+
pos = $.inArray(par.id, new_par.children) + 1;
|
4375 |
+
break;
|
4376 |
+
case "inside":
|
4377 |
+
case "first":
|
4378 |
+
pos = 0;
|
4379 |
+
break;
|
4380 |
+
case "last":
|
4381 |
+
pos = new_par.children.length;
|
4382 |
+
break;
|
4383 |
+
default:
|
4384 |
+
if(!pos) { pos = 0; }
|
4385 |
+
break;
|
4386 |
+
}
|
4387 |
+
if(pos > new_par.children.length) { pos = new_par.children.length; }
|
4388 |
+
if(!this.check("copy_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) {
|
4389 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
4390 |
+
return false;
|
4391 |
+
}
|
4392 |
+
node = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj;
|
4393 |
+
if(!node) { return false; }
|
4394 |
+
if(node.id === true) { delete node.id; }
|
4395 |
+
node = this._parse_model_from_json(node, new_par.id, new_par.parents.concat());
|
4396 |
+
if(!node) { return false; }
|
4397 |
+
tmp = this.get_node(node);
|
4398 |
+
if(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; }
|
4399 |
+
dpc = [];
|
4400 |
+
dpc.push(node);
|
4401 |
+
dpc = dpc.concat(tmp.children_d);
|
4402 |
+
this.trigger('model', { "nodes" : dpc, "parent" : new_par.id });
|
4403 |
+
|
4404 |
+
// insert into new parent and up
|
4405 |
+
for(i = 0, j = new_par.parents.length; i < j; i++) {
|
4406 |
+
this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(dpc);
|
4407 |
+
}
|
4408 |
+
dpc = [];
|
4409 |
+
for(i = 0, j = new_par.children.length; i < j; i++) {
|
4410 |
+
dpc[i >= pos ? i+1 : i] = new_par.children[i];
|
4411 |
+
}
|
4412 |
+
dpc[pos] = tmp.id;
|
4413 |
+
new_par.children = dpc;
|
4414 |
+
new_par.children_d.push(tmp.id);
|
4415 |
+
new_par.children_d = new_par.children_d.concat(tmp.children_d);
|
4416 |
+
|
4417 |
+
if(new_par.id === $.jstree.root) {
|
4418 |
+
this._model.force_full_redraw = true;
|
4419 |
+
}
|
4420 |
+
if(!this._model.force_full_redraw) {
|
4421 |
+
this._node_changed(new_par.id);
|
4422 |
+
}
|
4423 |
+
if(!skip_redraw) {
|
4424 |
+
this.redraw(new_par.id === $.jstree.root);
|
4425 |
+
}
|
4426 |
+
if(callback) { callback.call(this, tmp, new_par, pos); }
|
4427 |
+
/**
|
4428 |
+
* triggered when a node is copied
|
4429 |
+
* @event
|
4430 |
+
* @name copy_node.jstree
|
4431 |
+
* @param {Object} node the copied node
|
4432 |
+
* @param {Object} original the original node
|
4433 |
+
* @param {String} parent the parent's ID
|
4434 |
+
* @param {Number} position the position of the node among the parent's children
|
4435 |
+
* @param {String} old_parent the old parent of the node
|
4436 |
+
* @param {Number} old_position the position of the original node
|
4437 |
+
* @param {Boolean} is_multi do the node and new parent belong to different instances
|
4438 |
+
* @param {jsTree} old_instance the instance the node came from
|
4439 |
+
* @param {jsTree} new_instance the instance of the new parent
|
4440 |
+
*/
|
4441 |
+
this.trigger('copy_node', { "node" : tmp, "original" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1,'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this });
|
4442 |
+
return tmp.id;
|
4443 |
+
},
|
4444 |
+
/**
|
4445 |
+
* cut a node (a later call to `paste(obj)` would move the node)
|
4446 |
+
* @name cut(obj)
|
4447 |
+
* @param {mixed} obj multiple objects can be passed using an array
|
4448 |
+
* @trigger cut.jstree
|
4449 |
+
*/
|
4450 |
+
cut : function (obj) {
|
4451 |
+
if(!obj) { obj = this._data.core.selected.concat(); }
|
4452 |
+
if(!$.isArray(obj)) { obj = [obj]; }
|
4453 |
+
if(!obj.length) { return false; }
|
4454 |
+
var tmp = [], o, t1, t2;
|
4455 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4456 |
+
o = this.get_node(obj[t1]);
|
4457 |
+
if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); }
|
4458 |
+
}
|
4459 |
+
if(!tmp.length) { return false; }
|
4460 |
+
ccp_node = tmp;
|
4461 |
+
ccp_inst = this;
|
4462 |
+
ccp_mode = 'move_node';
|
4463 |
+
/**
|
4464 |
+
* triggered when nodes are added to the buffer for moving
|
4465 |
+
* @event
|
4466 |
+
* @name cut.jstree
|
4467 |
+
* @param {Array} node
|
4468 |
+
*/
|
4469 |
+
this.trigger('cut', { "node" : obj });
|
4470 |
+
},
|
4471 |
+
/**
|
4472 |
+
* copy a node (a later call to `paste(obj)` would copy the node)
|
4473 |
+
* @name copy(obj)
|
4474 |
+
* @param {mixed} obj multiple objects can be passed using an array
|
4475 |
+
* @trigger copy.jstree
|
4476 |
+
*/
|
4477 |
+
copy : function (obj) {
|
4478 |
+
if(!obj) { obj = this._data.core.selected.concat(); }
|
4479 |
+
if(!$.isArray(obj)) { obj = [obj]; }
|
4480 |
+
if(!obj.length) { return false; }
|
4481 |
+
var tmp = [], o, t1, t2;
|
4482 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4483 |
+
o = this.get_node(obj[t1]);
|
4484 |
+
if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); }
|
4485 |
+
}
|
4486 |
+
if(!tmp.length) { return false; }
|
4487 |
+
ccp_node = tmp;
|
4488 |
+
ccp_inst = this;
|
4489 |
+
ccp_mode = 'copy_node';
|
4490 |
+
/**
|
4491 |
+
* triggered when nodes are added to the buffer for copying
|
4492 |
+
* @event
|
4493 |
+
* @name copy.jstree
|
4494 |
+
* @param {Array} node
|
4495 |
+
*/
|
4496 |
+
this.trigger('copy', { "node" : obj });
|
4497 |
+
},
|
4498 |
+
/**
|
4499 |
+
* get the current buffer (any nodes that are waiting for a paste operation)
|
4500 |
+
* @name get_buffer()
|
4501 |
+
* @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance)
|
4502 |
+
*/
|
4503 |
+
get_buffer : function () {
|
4504 |
+
return { 'mode' : ccp_mode, 'node' : ccp_node, 'inst' : ccp_inst };
|
4505 |
+
},
|
4506 |
+
/**
|
4507 |
+
* check if there is something in the buffer to paste
|
4508 |
+
* @name can_paste()
|
4509 |
+
* @return {Boolean}
|
4510 |
+
*/
|
4511 |
+
can_paste : function () {
|
4512 |
+
return ccp_mode !== false && ccp_node !== false; // && ccp_inst._model.data[ccp_node];
|
4513 |
+
},
|
4514 |
+
/**
|
4515 |
+
* copy or move the previously cut or copied nodes to a new parent
|
4516 |
+
* @name paste(obj [, pos])
|
4517 |
+
* @param {mixed} obj the new parent
|
4518 |
+
* @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0`
|
4519 |
+
* @trigger paste.jstree
|
4520 |
+
*/
|
4521 |
+
paste : function (obj, pos) {
|
4522 |
+
obj = this.get_node(obj);
|
4523 |
+
if(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; }
|
4524 |
+
if(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) {
|
4525 |
+
/**
|
4526 |
+
* triggered when paste is invoked
|
4527 |
+
* @event
|
4528 |
+
* @name paste.jstree
|
4529 |
+
* @param {String} parent the ID of the receiving node
|
4530 |
+
* @param {Array} node the nodes in the buffer
|
4531 |
+
* @param {String} mode the performed operation - "copy_node" or "move_node"
|
4532 |
+
*/
|
4533 |
+
this.trigger('paste', { "parent" : obj.id, "node" : ccp_node, "mode" : ccp_mode });
|
4534 |
+
}
|
4535 |
+
ccp_node = false;
|
4536 |
+
ccp_mode = false;
|
4537 |
+
ccp_inst = false;
|
4538 |
+
},
|
4539 |
+
/**
|
4540 |
+
* clear the buffer of previously copied or cut nodes
|
4541 |
+
* @name clear_buffer()
|
4542 |
+
* @trigger clear_buffer.jstree
|
4543 |
+
*/
|
4544 |
+
clear_buffer : function () {
|
4545 |
+
ccp_node = false;
|
4546 |
+
ccp_mode = false;
|
4547 |
+
ccp_inst = false;
|
4548 |
+
/**
|
4549 |
+
* triggered when the copy / cut buffer is cleared
|
4550 |
+
* @event
|
4551 |
+
* @name clear_buffer.jstree
|
4552 |
+
*/
|
4553 |
+
this.trigger('clear_buffer');
|
4554 |
+
},
|
4555 |
+
/**
|
4556 |
+
* put a node in edit mode (input field to rename the node)
|
4557 |
+
* @name edit(obj [, default_text, callback])
|
4558 |
+
* @param {mixed} obj
|
4559 |
+
* @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used)
|
4560 |
+
* @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text
|
4561 |
+
*/
|
4562 |
+
edit : function (obj, default_text, callback) {
|
4563 |
+
var rtl, w, a, s, t, h1, h2, fn, tmp, cancel = false;
|
4564 |
+
obj = this.get_node(obj);
|
4565 |
+
if(!obj) { return false; }
|
4566 |
+
if(!this.check("edit", obj, this.get_parent(obj))) {
|
4567 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
4568 |
+
return false;
|
4569 |
+
}
|
4570 |
+
tmp = obj;
|
4571 |
+
default_text = typeof default_text === 'string' ? default_text : obj.text;
|
4572 |
+
this.set_text(obj, "");
|
4573 |
+
obj = this._open_to(obj);
|
4574 |
+
tmp.text = default_text;
|
4575 |
+
|
4576 |
+
rtl = this._data.core.rtl;
|
4577 |
+
w = this.element.width();
|
4578 |
+
this._data.core.focused = tmp.id;
|
4579 |
+
a = obj.children('.jstree-anchor').focus();
|
4580 |
+
s = $('<span></span>');
|
4581 |
+
/*!
|
4582 |
+
oi = obj.children("i:visible"),
|
4583 |
+
ai = a.children("i:visible"),
|
4584 |
+
w1 = oi.width() * oi.length,
|
4585 |
+
w2 = ai.width() * ai.length,
|
4586 |
+
*/
|
4587 |
+
t = default_text;
|
4588 |
+
h1 = $("<"+"div></div>", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo(document.body);
|
4589 |
+
h2 = $("<"+"input />", {
|
4590 |
+
"value" : t,
|
4591 |
+
"class" : "jstree-rename-input",
|
4592 |
+
// "size" : t.length,
|
4593 |
+
"css" : {
|
4594 |
+
"padding" : "0",
|
4595 |
+
"border" : "1px solid silver",
|
4596 |
+
"box-sizing" : "border-box",
|
4597 |
+
"display" : "inline-block",
|
4598 |
+
"height" : (this._data.core.li_height) + "px",
|
4599 |
+
"lineHeight" : (this._data.core.li_height) + "px",
|
4600 |
+
"width" : "150px" // will be set a bit further down
|
4601 |
+
},
|
4602 |
+
"blur" : $.proxy(function (e) {
|
4603 |
+
e.stopImmediatePropagation();
|
4604 |
+
e.preventDefault();
|
4605 |
+
var i = s.children(".jstree-rename-input"),
|
4606 |
+
v = i.val(),
|
4607 |
+
f = this.settings.core.force_text,
|
4608 |
+
nv;
|
4609 |
+
if(v === "") { v = t; }
|
4610 |
+
h1.remove();
|
4611 |
+
s.replaceWith(a);
|
4612 |
+
s.remove();
|
4613 |
+
t = f ? t : $('<div></div>').append($.parseHTML(t)).html();
|
4614 |
+
obj = this.get_node(obj);
|
4615 |
+
this.set_text(obj, t);
|
4616 |
+
nv = !!this.rename_node(obj, f ? $('<div></div>').text(v).text() : $('<div></div>').append($.parseHTML(v)).html());
|
4617 |
+
if(!nv) {
|
4618 |
+
this.set_text(obj, t); // move this up? and fix #483
|
4619 |
+
}
|
4620 |
+
this._data.core.focused = tmp.id;
|
4621 |
+
setTimeout($.proxy(function () {
|
4622 |
+
var node = this.get_node(tmp.id, true);
|
4623 |
+
if(node.length) {
|
4624 |
+
this._data.core.focused = tmp.id;
|
4625 |
+
node.children('.jstree-anchor').focus();
|
4626 |
+
}
|
4627 |
+
}, this), 0);
|
4628 |
+
if(callback) {
|
4629 |
+
callback.call(this, tmp, nv, cancel);
|
4630 |
+
}
|
4631 |
+
h2 = null;
|
4632 |
+
}, this),
|
4633 |
+
"keydown" : function (e) {
|
4634 |
+
var key = e.which;
|
4635 |
+
if(key === 27) {
|
4636 |
+
cancel = true;
|
4637 |
+
this.value = t;
|
4638 |
+
}
|
4639 |
+
if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) {
|
4640 |
+
e.stopImmediatePropagation();
|
4641 |
+
}
|
4642 |
+
if(key === 27 || key === 13) {
|
4643 |
+
e.preventDefault();
|
4644 |
+
this.blur();
|
4645 |
+
}
|
4646 |
+
},
|
4647 |
+
"click" : function (e) { e.stopImmediatePropagation(); },
|
4648 |
+
"mousedown" : function (e) { e.stopImmediatePropagation(); },
|
4649 |
+
"keyup" : function (e) {
|
4650 |
+
h2.width(Math.min(h1.text("pW" + this.value).width(),w));
|
4651 |
+
},
|
4652 |
+
"keypress" : function(e) {
|
4653 |
+
if(e.which === 13) { return false; }
|
4654 |
+
}
|
4655 |
+
});
|
4656 |
+
fn = {
|
4657 |
+
fontFamily : a.css('fontFamily') || '',
|
4658 |
+
fontSize : a.css('fontSize') || '',
|
4659 |
+
fontWeight : a.css('fontWeight') || '',
|
4660 |
+
fontStyle : a.css('fontStyle') || '',
|
4661 |
+
fontStretch : a.css('fontStretch') || '',
|
4662 |
+
fontVariant : a.css('fontVariant') || '',
|
4663 |
+
letterSpacing : a.css('letterSpacing') || '',
|
4664 |
+
wordSpacing : a.css('wordSpacing') || ''
|
4665 |
+
};
|
4666 |
+
s.attr('class', a.attr('class')).append(a.contents().clone()).append(h2);
|
4667 |
+
a.replaceWith(s);
|
4668 |
+
h1.css(fn);
|
4669 |
+
h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
|
4670 |
+
$(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) {
|
4671 |
+
if (h2 && e.target !== h2) {
|
4672 |
+
$(h2).blur();
|
4673 |
+
}
|
4674 |
+
});
|
4675 |
+
},
|
4676 |
+
|
4677 |
+
|
4678 |
+
/**
|
4679 |
+
* changes the theme
|
4680 |
+
* @name set_theme(theme_name [, theme_url])
|
4681 |
+
* @param {String} theme_name the name of the new theme to apply
|
4682 |
+
* @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory.
|
4683 |
+
* @trigger set_theme.jstree
|
4684 |
+
*/
|
4685 |
+
set_theme : function (theme_name, theme_url) {
|
4686 |
+
if(!theme_name) { return false; }
|
4687 |
+
if(theme_url === true) {
|
4688 |
+
var dir = this.settings.core.themes.dir;
|
4689 |
+
if(!dir) { dir = $.jstree.path + '/themes'; }
|
4690 |
+
theme_url = dir + '/' + theme_name + '/style.css';
|
4691 |
+
}
|
4692 |
+
if(theme_url && $.inArray(theme_url, themes_loaded) === -1) {
|
4693 |
+
$('head').append('<'+'link rel="stylesheet" href="' + theme_url + '" type="text/css" />');
|
4694 |
+
themes_loaded.push(theme_url);
|
4695 |
+
}
|
4696 |
+
if(this._data.core.themes.name) {
|
4697 |
+
this.element.removeClass('jstree-' + this._data.core.themes.name);
|
4698 |
+
}
|
4699 |
+
this._data.core.themes.name = theme_name;
|
4700 |
+
this.element.addClass('jstree-' + theme_name);
|
4701 |
+
this.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive');
|
4702 |
+
/**
|
4703 |
+
* triggered when a theme is set
|
4704 |
+
* @event
|
4705 |
+
* @name set_theme.jstree
|
4706 |
+
* @param {String} theme the new theme
|
4707 |
+
*/
|
4708 |
+
this.trigger('set_theme', { 'theme' : theme_name });
|
4709 |
+
},
|
4710 |
+
/**
|
4711 |
+
* gets the name of the currently applied theme name
|
4712 |
+
* @name get_theme()
|
4713 |
+
* @return {String}
|
4714 |
+
*/
|
4715 |
+
get_theme : function () { return this._data.core.themes.name; },
|
4716 |
+
/**
|
4717 |
+
* changes the theme variant (if the theme has variants)
|
4718 |
+
* @name set_theme_variant(variant_name)
|
4719 |
+
* @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed)
|
4720 |
+
*/
|
4721 |
+
set_theme_variant : function (variant_name) {
|
4722 |
+
if(this._data.core.themes.variant) {
|
4723 |
+
this.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant);
|
4724 |
+
}
|
4725 |
+
this._data.core.themes.variant = variant_name;
|
4726 |
+
if(variant_name) {
|
4727 |
+
this.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant);
|
4728 |
+
}
|
4729 |
+
},
|
4730 |
+
/**
|
4731 |
+
* gets the name of the currently applied theme variant
|
4732 |
+
* @name get_theme()
|
4733 |
+
* @return {String}
|
4734 |
+
*/
|
4735 |
+
get_theme_variant : function () { return this._data.core.themes.variant; },
|
4736 |
+
/**
|
4737 |
+
* shows a striped background on the container (if the theme supports it)
|
4738 |
+
* @name show_stripes()
|
4739 |
+
*/
|
4740 |
+
show_stripes : function () {
|
4741 |
+
this._data.core.themes.stripes = true;
|
4742 |
+
this.get_container_ul().addClass("jstree-striped");
|
4743 |
+
/**
|
4744 |
+
* triggered when stripes are shown
|
4745 |
+
* @event
|
4746 |
+
* @name show_stripes.jstree
|
4747 |
+
*/
|
4748 |
+
this.trigger('show_stripes');
|
4749 |
+
},
|
4750 |
+
/**
|
4751 |
+
* hides the striped background on the container
|
4752 |
+
* @name hide_stripes()
|
4753 |
+
*/
|
4754 |
+
hide_stripes : function () {
|
4755 |
+
this._data.core.themes.stripes = false;
|
4756 |
+
this.get_container_ul().removeClass("jstree-striped");
|
4757 |
+
/**
|
4758 |
+
* triggered when stripes are hidden
|
4759 |
+
* @event
|
4760 |
+
* @name hide_stripes.jstree
|
4761 |
+
*/
|
4762 |
+
this.trigger('hide_stripes');
|
4763 |
+
},
|
4764 |
+
/**
|
4765 |
+
* toggles the striped background on the container
|
4766 |
+
* @name toggle_stripes()
|
4767 |
+
*/
|
4768 |
+
toggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } },
|
4769 |
+
/**
|
4770 |
+
* shows the connecting dots (if the theme supports it)
|
4771 |
+
* @name show_dots()
|
4772 |
+
*/
|
4773 |
+
show_dots : function () {
|
4774 |
+
this._data.core.themes.dots = true;
|
4775 |
+
this.get_container_ul().removeClass("jstree-no-dots");
|
4776 |
+
/**
|
4777 |
+
* triggered when dots are shown
|
4778 |
+
* @event
|
4779 |
+
* @name show_dots.jstree
|
4780 |
+
*/
|
4781 |
+
this.trigger('show_dots');
|
4782 |
+
},
|
4783 |
+
/**
|
4784 |
+
* hides the connecting dots
|
4785 |
+
* @name hide_dots()
|
4786 |
+
*/
|
4787 |
+
hide_dots : function () {
|
4788 |
+
this._data.core.themes.dots = false;
|
4789 |
+
this.get_container_ul().addClass("jstree-no-dots");
|
4790 |
+
/**
|
4791 |
+
* triggered when dots are hidden
|
4792 |
+
* @event
|
4793 |
+
* @name hide_dots.jstree
|
4794 |
+
*/
|
4795 |
+
this.trigger('hide_dots');
|
4796 |
+
},
|
4797 |
+
/**
|
4798 |
+
* toggles the connecting dots
|
4799 |
+
* @name toggle_dots()
|
4800 |
+
*/
|
4801 |
+
toggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
|
4802 |
+
/**
|
4803 |
+
* show the node icons
|
4804 |
+
* @name show_icons()
|
4805 |
+
*/
|
4806 |
+
show_icons : function () {
|
4807 |
+
this._data.core.themes.icons = true;
|
4808 |
+
this.get_container_ul().removeClass("jstree-no-icons");
|
4809 |
+
/**
|
4810 |
+
* triggered when icons are shown
|
4811 |
+
* @event
|
4812 |
+
* @name show_icons.jstree
|
4813 |
+
*/
|
4814 |
+
this.trigger('show_icons');
|
4815 |
+
},
|
4816 |
+
/**
|
4817 |
+
* hide the node icons
|
4818 |
+
* @name hide_icons()
|
4819 |
+
*/
|
4820 |
+
hide_icons : function () {
|
4821 |
+
this._data.core.themes.icons = false;
|
4822 |
+
this.get_container_ul().addClass("jstree-no-icons");
|
4823 |
+
/**
|
4824 |
+
* triggered when icons are hidden
|
4825 |
+
* @event
|
4826 |
+
* @name hide_icons.jstree
|
4827 |
+
*/
|
4828 |
+
this.trigger('hide_icons');
|
4829 |
+
},
|
4830 |
+
/**
|
4831 |
+
* toggle the node icons
|
4832 |
+
* @name toggle_icons()
|
4833 |
+
*/
|
4834 |
+
toggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } },
|
4835 |
+
/**
|
4836 |
+
* show the node ellipsis
|
4837 |
+
* @name show_icons()
|
4838 |
+
*/
|
4839 |
+
show_ellipsis : function () {
|
4840 |
+
this._data.core.themes.ellipsis = true;
|
4841 |
+
this.get_container_ul().addClass("jstree-ellipsis");
|
4842 |
+
/**
|
4843 |
+
* triggered when ellisis is shown
|
4844 |
+
* @event
|
4845 |
+
* @name show_ellipsis.jstree
|
4846 |
+
*/
|
4847 |
+
this.trigger('show_ellipsis');
|
4848 |
+
},
|
4849 |
+
/**
|
4850 |
+
* hide the node ellipsis
|
4851 |
+
* @name hide_ellipsis()
|
4852 |
+
*/
|
4853 |
+
hide_ellipsis : function () {
|
4854 |
+
this._data.core.themes.ellipsis = false;
|
4855 |
+
this.get_container_ul().removeClass("jstree-ellipsis");
|
4856 |
+
/**
|
4857 |
+
* triggered when ellisis is hidden
|
4858 |
+
* @event
|
4859 |
+
* @name hide_ellipsis.jstree
|
4860 |
+
*/
|
4861 |
+
this.trigger('hide_ellipsis');
|
4862 |
+
},
|
4863 |
+
/**
|
4864 |
+
* toggle the node ellipsis
|
4865 |
+
* @name toggle_icons()
|
4866 |
+
*/
|
4867 |
+
toggle_ellipsis : function () { if(this._data.core.themes.ellipsis) { this.hide_ellipsis(); } else { this.show_ellipsis(); } },
|
4868 |
+
/**
|
4869 |
+
* set the node icon for a node
|
4870 |
+
* @name set_icon(obj, icon)
|
4871 |
+
* @param {mixed} obj
|
4872 |
+
* @param {String} icon the new icon - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class
|
4873 |
+
*/
|
4874 |
+
set_icon : function (obj, icon) {
|
4875 |
+
var t1, t2, dom, old;
|
4876 |
+
if($.isArray(obj)) {
|
4877 |
+
obj = obj.slice();
|
4878 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4879 |
+
this.set_icon(obj[t1], icon);
|
4880 |
+
}
|
4881 |
+
return true;
|
4882 |
+
}
|
4883 |
+
obj = this.get_node(obj);
|
4884 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
4885 |
+
old = obj.icon;
|
4886 |
+
obj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon;
|
4887 |
+
dom = this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon");
|
4888 |
+
if(icon === false) {
|
4889 |
+
dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel");
|
4890 |
+
this.hide_icon(obj);
|
4891 |
+
}
|
4892 |
+
else if(icon === true || icon === null || icon === undefined || icon === '') {
|
4893 |
+
dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel");
|
4894 |
+
if(old === false) { this.show_icon(obj); }
|
4895 |
+
}
|
4896 |
+
else if(icon.indexOf("/") === -1 && icon.indexOf(".") === -1) {
|
4897 |
+
dom.removeClass(old).css("background","");
|
4898 |
+
dom.addClass(icon + ' jstree-themeicon-custom').attr("rel",icon);
|
4899 |
+
if(old === false) { this.show_icon(obj); }
|
4900 |
+
}
|
4901 |
+
else {
|
4902 |
+
dom.removeClass(old).css("background","");
|
4903 |
+
dom.addClass('jstree-themeicon-custom').css("background", "url('" + icon + "') center center no-repeat").attr("rel",icon);
|
4904 |
+
if(old === false) { this.show_icon(obj); }
|
4905 |
+
}
|
4906 |
+
return true;
|
4907 |
+
},
|
4908 |
+
/**
|
4909 |
+
* get the node icon for a node
|
4910 |
+
* @name get_icon(obj)
|
4911 |
+
* @param {mixed} obj
|
4912 |
+
* @return {String}
|
4913 |
+
*/
|
4914 |
+
get_icon : function (obj) {
|
4915 |
+
obj = this.get_node(obj);
|
4916 |
+
return (!obj || obj.id === $.jstree.root) ? false : obj.icon;
|
4917 |
+
},
|
4918 |
+
/**
|
4919 |
+
* hide the icon on an individual node
|
4920 |
+
* @name hide_icon(obj)
|
4921 |
+
* @param {mixed} obj
|
4922 |
+
*/
|
4923 |
+
hide_icon : function (obj) {
|
4924 |
+
var t1, t2;
|
4925 |
+
if($.isArray(obj)) {
|
4926 |
+
obj = obj.slice();
|
4927 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4928 |
+
this.hide_icon(obj[t1]);
|
4929 |
+
}
|
4930 |
+
return true;
|
4931 |
+
}
|
4932 |
+
obj = this.get_node(obj);
|
4933 |
+
if(!obj || obj === $.jstree.root) { return false; }
|
4934 |
+
obj.icon = false;
|
4935 |
+
this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon").addClass('jstree-themeicon-hidden');
|
4936 |
+
return true;
|
4937 |
+
},
|
4938 |
+
/**
|
4939 |
+
* show the icon on an individual node
|
4940 |
+
* @name show_icon(obj)
|
4941 |
+
* @param {mixed} obj
|
4942 |
+
*/
|
4943 |
+
show_icon : function (obj) {
|
4944 |
+
var t1, t2, dom;
|
4945 |
+
if($.isArray(obj)) {
|
4946 |
+
obj = obj.slice();
|
4947 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
4948 |
+
this.show_icon(obj[t1]);
|
4949 |
+
}
|
4950 |
+
return true;
|
4951 |
+
}
|
4952 |
+
obj = this.get_node(obj);
|
4953 |
+
if(!obj || obj === $.jstree.root) { return false; }
|
4954 |
+
dom = this.get_node(obj, true);
|
4955 |
+
obj.icon = dom.length ? dom.children(".jstree-anchor").children(".jstree-themeicon").attr('rel') : true;
|
4956 |
+
if(!obj.icon) { obj.icon = true; }
|
4957 |
+
dom.children(".jstree-anchor").children(".jstree-themeicon").removeClass('jstree-themeicon-hidden');
|
4958 |
+
return true;
|
4959 |
+
}
|
4960 |
+
};
|
4961 |
+
|
4962 |
+
// helpers
|
4963 |
+
$.vakata = {};
|
4964 |
+
// collect attributes
|
4965 |
+
$.vakata.attributes = function(node, with_values) {
|
4966 |
+
node = $(node)[0];
|
4967 |
+
var attr = with_values ? {} : [];
|
4968 |
+
if(node && node.attributes) {
|
4969 |
+
$.each(node.attributes, function (i, v) {
|
4970 |
+
if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; }
|
4971 |
+
if(v.value !== null && $.trim(v.value) !== '') {
|
4972 |
+
if(with_values) { attr[v.name] = v.value; }
|
4973 |
+
else { attr.push(v.name); }
|
4974 |
+
}
|
4975 |
+
});
|
4976 |
+
}
|
4977 |
+
return attr;
|
4978 |
+
};
|
4979 |
+
$.vakata.array_unique = function(array) {
|
4980 |
+
var a = [], i, j, l, o = {};
|
4981 |
+
for(i = 0, l = array.length; i < l; i++) {
|
4982 |
+
if(o[array[i]] === undefined) {
|
4983 |
+
a.push(array[i]);
|
4984 |
+
o[array[i]] = true;
|
4985 |
+
}
|
4986 |
+
}
|
4987 |
+
return a;
|
4988 |
+
};
|
4989 |
+
// remove item from array
|
4990 |
+
$.vakata.array_remove = function(array, from) {
|
4991 |
+
array.splice(from, 1);
|
4992 |
+
return array;
|
4993 |
+
//var rest = array.slice((to || from) + 1 || array.length);
|
4994 |
+
//array.length = from < 0 ? array.length + from : from;
|
4995 |
+
//array.push.apply(array, rest);
|
4996 |
+
//return array;
|
4997 |
+
};
|
4998 |
+
// remove item from array
|
4999 |
+
$.vakata.array_remove_item = function(array, item) {
|
5000 |
+
var tmp = $.inArray(item, array);
|
5001 |
+
return tmp !== -1 ? $.vakata.array_remove(array, tmp) : array;
|
5002 |
+
};
|
5003 |
+
$.vakata.array_filter = function(c,a,b,d,e) {
|
5004 |
+
if (c.filter) {
|
5005 |
+
return c.filter(a, b);
|
5006 |
+
}
|
5007 |
+
d=[];
|
5008 |
+
for (e in c) {
|
5009 |
+
if (~~e+''===e+'' && e>=0 && a.call(b,c[e],+e,c)) {
|
5010 |
+
d.push(c[e]);
|
5011 |
+
}
|
5012 |
+
}
|
5013 |
+
return d;
|
5014 |
+
};
|
5015 |
+
|
5016 |
+
|
5017 |
+
/**
|
5018 |
+
* ### Changed plugin
|
5019 |
+
*
|
5020 |
+
* This plugin adds more information to the `changed.jstree` event. The new data is contained in the `changed` event data property, and contains a lists of `selected` and `deselected` nodes.
|
5021 |
+
*/
|
5022 |
+
|
5023 |
+
$.jstree.plugins.changed = function (options, parent) {
|
5024 |
+
var last = [];
|
5025 |
+
this.trigger = function (ev, data) {
|
5026 |
+
var i, j;
|
5027 |
+
if(!data) {
|
5028 |
+
data = {};
|
5029 |
+
}
|
5030 |
+
if(ev.replace('.jstree','') === 'changed') {
|
5031 |
+
data.changed = { selected : [], deselected : [] };
|
5032 |
+
var tmp = {};
|
5033 |
+
for(i = 0, j = last.length; i < j; i++) {
|
5034 |
+
tmp[last[i]] = 1;
|
5035 |
+
}
|
5036 |
+
for(i = 0, j = data.selected.length; i < j; i++) {
|
5037 |
+
if(!tmp[data.selected[i]]) {
|
5038 |
+
data.changed.selected.push(data.selected[i]);
|
5039 |
+
}
|
5040 |
+
else {
|
5041 |
+
tmp[data.selected[i]] = 2;
|
5042 |
+
}
|
5043 |
+
}
|
5044 |
+
for(i = 0, j = last.length; i < j; i++) {
|
5045 |
+
if(tmp[last[i]] === 1) {
|
5046 |
+
data.changed.deselected.push(last[i]);
|
5047 |
+
}
|
5048 |
+
}
|
5049 |
+
last = data.selected.slice();
|
5050 |
+
}
|
5051 |
+
/**
|
5052 |
+
* triggered when selection changes (the "changed" plugin enhances the original event with more data)
|
5053 |
+
* @event
|
5054 |
+
* @name changed.jstree
|
5055 |
+
* @param {Object} node
|
5056 |
+
* @param {Object} action the action that caused the selection to change
|
5057 |
+
* @param {Array} selected the current selection
|
5058 |
+
* @param {Object} changed an object containing two properties `selected` and `deselected` - both arrays of node IDs, which were selected or deselected since the last changed event
|
5059 |
+
* @param {Object} event the event (if any) that triggered this changed event
|
5060 |
+
* @plugin changed
|
5061 |
+
*/
|
5062 |
+
parent.trigger.call(this, ev, data);
|
5063 |
+
};
|
5064 |
+
this.refresh = function (skip_loading, forget_state) {
|
5065 |
+
last = [];
|
5066 |
+
return parent.refresh.apply(this, arguments);
|
5067 |
+
};
|
5068 |
+
};
|
5069 |
+
|
5070 |
+
/**
|
5071 |
+
* ### Checkbox plugin
|
5072 |
+
*
|
5073 |
+
* This plugin renders checkbox icons in front of each node, making multiple selection much easier.
|
5074 |
+
* It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up.
|
5075 |
+
*/
|
5076 |
+
|
5077 |
+
var _i = document.createElement('I');
|
5078 |
+
_i.className = 'jstree-icon jstree-checkbox';
|
5079 |
+
_i.setAttribute('role', 'presentation');
|
5080 |
+
/**
|
5081 |
+
* stores all defaults for the checkbox plugin
|
5082 |
+
* @name $.jstree.defaults.checkbox
|
5083 |
+
* @plugin checkbox
|
5084 |
+
*/
|
5085 |
+
$.jstree.defaults.checkbox = {
|
5086 |
+
/**
|
5087 |
+
* a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`.
|
5088 |
+
* @name $.jstree.defaults.checkbox.visible
|
5089 |
+
* @plugin checkbox
|
5090 |
+
*/
|
5091 |
+
visible : true,
|
5092 |
+
/**
|
5093 |
+
* a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`.
|
5094 |
+
* @name $.jstree.defaults.checkbox.three_state
|
5095 |
+
* @plugin checkbox
|
5096 |
+
*/
|
5097 |
+
three_state : true,
|
5098 |
+
/**
|
5099 |
+
* a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`.
|
5100 |
+
* @name $.jstree.defaults.checkbox.whole_node
|
5101 |
+
* @plugin checkbox
|
5102 |
+
*/
|
5103 |
+
whole_node : true,
|
5104 |
+
/**
|
5105 |
+
* a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`.
|
5106 |
+
* @name $.jstree.defaults.checkbox.keep_selected_style
|
5107 |
+
* @plugin checkbox
|
5108 |
+
*/
|
5109 |
+
keep_selected_style : true,
|
5110 |
+
/**
|
5111 |
+
* This setting controls how cascading and undetermined nodes are applied.
|
5112 |
+
* If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used.
|
5113 |
+
* If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''.
|
5114 |
+
* @name $.jstree.defaults.checkbox.cascade
|
5115 |
+
* @plugin checkbox
|
5116 |
+
*/
|
5117 |
+
cascade : '',
|
5118 |
+
/**
|
5119 |
+
* This setting controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing.
|
5120 |
+
* @name $.jstree.defaults.checkbox.tie_selection
|
5121 |
+
* @plugin checkbox
|
5122 |
+
*/
|
5123 |
+
tie_selection : true,
|
5124 |
+
|
5125 |
+
/**
|
5126 |
+
* This setting controls if cascading down affects disabled checkboxes
|
5127 |
+
* @name $.jstree.defaults.checkbox.cascade_to_disabled
|
5128 |
+
* @plugin checkbox
|
5129 |
+
*/
|
5130 |
+
cascade_to_disabled : true,
|
5131 |
+
|
5132 |
+
/**
|
5133 |
+
* This setting controls if cascading down affects hidden checkboxes
|
5134 |
+
* @name $.jstree.defaults.checkbox.cascade_to_hidden
|
5135 |
+
* @plugin checkbox
|
5136 |
+
*/
|
5137 |
+
cascade_to_hidden : true
|
5138 |
+
};
|
5139 |
+
$.jstree.plugins.checkbox = function (options, parent) {
|
5140 |
+
this.bind = function () {
|
5141 |
+
parent.bind.call(this);
|
5142 |
+
this._data.checkbox.uto = false;
|
5143 |
+
this._data.checkbox.selected = [];
|
5144 |
+
if(this.settings.checkbox.three_state) {
|
5145 |
+
this.settings.checkbox.cascade = 'up+down+undetermined';
|
5146 |
+
}
|
5147 |
+
this.element
|
5148 |
+
.on("init.jstree", $.proxy(function () {
|
5149 |
+
this._data.checkbox.visible = this.settings.checkbox.visible;
|
5150 |
+
if(!this.settings.checkbox.keep_selected_style) {
|
5151 |
+
this.element.addClass('jstree-checkbox-no-clicked');
|
5152 |
+
}
|
5153 |
+
if(this.settings.checkbox.tie_selection) {
|
5154 |
+
this.element.addClass('jstree-checkbox-selection');
|
5155 |
+
}
|
5156 |
+
}, this))
|
5157 |
+
.on("loading.jstree", $.proxy(function () {
|
5158 |
+
this[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ]();
|
5159 |
+
}, this));
|
5160 |
+
if(this.settings.checkbox.cascade.indexOf('undetermined') !== -1) {
|
5161 |
+
this.element
|
5162 |
+
.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', $.proxy(function () {
|
5163 |
+
// only if undetermined is in setting
|
5164 |
+
if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }
|
5165 |
+
this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50);
|
5166 |
+
}, this));
|
5167 |
+
}
|
5168 |
+
if(!this.settings.checkbox.tie_selection) {
|
5169 |
+
this.element
|
5170 |
+
.on('model.jstree', $.proxy(function (e, data) {
|
5171 |
+
var m = this._model.data,
|
5172 |
+
p = m[data.parent],
|
5173 |
+
dpc = data.nodes,
|
5174 |
+
i, j;
|
5175 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
5176 |
+
m[dpc[i]].state.checked = m[dpc[i]].state.checked || (m[dpc[i]].original && m[dpc[i]].original.state && m[dpc[i]].original.state.checked);
|
5177 |
+
if(m[dpc[i]].state.checked) {
|
5178 |
+
this._data.checkbox.selected.push(dpc[i]);
|
5179 |
+
}
|
5180 |
+
}
|
5181 |
+
}, this));
|
5182 |
+
}
|
5183 |
+
if(this.settings.checkbox.cascade.indexOf('up') !== -1 || this.settings.checkbox.cascade.indexOf('down') !== -1) {
|
5184 |
+
this.element
|
5185 |
+
.on('model.jstree', $.proxy(function (e, data) {
|
5186 |
+
var m = this._model.data,
|
5187 |
+
p = m[data.parent],
|
5188 |
+
dpc = data.nodes,
|
5189 |
+
chd = [],
|
5190 |
+
c, i, j, k, l, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection;
|
5191 |
+
|
5192 |
+
if(s.indexOf('down') !== -1) {
|
5193 |
+
// apply down
|
5194 |
+
if(p.state[ t ? 'selected' : 'checked' ]) {
|
5195 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
5196 |
+
m[dpc[i]].state[ t ? 'selected' : 'checked' ] = true;
|
5197 |
+
}
|
5198 |
+
|
5199 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(dpc);
|
5200 |
+
}
|
5201 |
+
else {
|
5202 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
5203 |
+
if(m[dpc[i]].state[ t ? 'selected' : 'checked' ]) {
|
5204 |
+
for(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) {
|
5205 |
+
m[m[dpc[i]].children_d[k]].state[ t ? 'selected' : 'checked' ] = true;
|
5206 |
+
}
|
5207 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(m[dpc[i]].children_d);
|
5208 |
+
}
|
5209 |
+
}
|
5210 |
+
}
|
5211 |
+
}
|
5212 |
+
|
5213 |
+
if(s.indexOf('up') !== -1) {
|
5214 |
+
// apply up
|
5215 |
+
for(i = 0, j = p.children_d.length; i < j; i++) {
|
5216 |
+
if(!m[p.children_d[i]].children.length) {
|
5217 |
+
chd.push(m[p.children_d[i]].parent);
|
5218 |
+
}
|
5219 |
+
}
|
5220 |
+
chd = $.vakata.array_unique(chd);
|
5221 |
+
for(k = 0, l = chd.length; k < l; k++) {
|
5222 |
+
p = m[chd[k]];
|
5223 |
+
while(p && p.id !== $.jstree.root) {
|
5224 |
+
c = 0;
|
5225 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
5226 |
+
c += m[p.children[i]].state[ t ? 'selected' : 'checked' ];
|
5227 |
+
}
|
5228 |
+
if(c === j) {
|
5229 |
+
p.state[ t ? 'selected' : 'checked' ] = true;
|
5230 |
+
this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);
|
5231 |
+
tmp = this.get_node(p, true);
|
5232 |
+
if(tmp && tmp.length) {
|
5233 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass( t ? 'jstree-clicked' : 'jstree-checked');
|
5234 |
+
}
|
5235 |
+
}
|
5236 |
+
else {
|
5237 |
+
break;
|
5238 |
+
}
|
5239 |
+
p = this.get_node(p.parent);
|
5240 |
+
}
|
5241 |
+
}
|
5242 |
+
}
|
5243 |
+
|
5244 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected);
|
5245 |
+
}, this))
|
5246 |
+
.on(this.settings.checkbox.tie_selection ? 'select_node.jstree' : 'check_node.jstree', $.proxy(function (e, data) {
|
5247 |
+
var self = this,
|
5248 |
+
obj = data.node,
|
5249 |
+
m = this._model.data,
|
5250 |
+
par = this.get_node(obj.parent),
|
5251 |
+
i, j, c, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection,
|
5252 |
+
sel = {}, cur = this._data[ t ? 'core' : 'checkbox' ].selected;
|
5253 |
+
|
5254 |
+
for (i = 0, j = cur.length; i < j; i++) {
|
5255 |
+
sel[cur[i]] = true;
|
5256 |
+
}
|
5257 |
+
|
5258 |
+
// apply down
|
5259 |
+
if(s.indexOf('down') !== -1) {
|
5260 |
+
//this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d));
|
5261 |
+
var selectedIds = this._cascade_new_checked_state(obj.id, true);
|
5262 |
+
var temp = obj.children_d.concat(obj.id);
|
5263 |
+
for (i = 0, j = temp.length; i < j; i++) {
|
5264 |
+
if (selectedIds.indexOf(temp[i]) > -1) {
|
5265 |
+
sel[temp[i]] = true;
|
5266 |
+
}
|
5267 |
+
else {
|
5268 |
+
delete sel[temp[i]];
|
5269 |
+
}
|
5270 |
+
}
|
5271 |
+
}
|
5272 |
+
|
5273 |
+
// apply up
|
5274 |
+
if(s.indexOf('up') !== -1) {
|
5275 |
+
while(par && par.id !== $.jstree.root) {
|
5276 |
+
c = 0;
|
5277 |
+
for(i = 0, j = par.children.length; i < j; i++) {
|
5278 |
+
c += m[par.children[i]].state[ t ? 'selected' : 'checked' ];
|
5279 |
+
}
|
5280 |
+
if(c === j) {
|
5281 |
+
par.state[ t ? 'selected' : 'checked' ] = true;
|
5282 |
+
sel[par.id] = true;
|
5283 |
+
//this._data[ t ? 'core' : 'checkbox' ].selected.push(par.id);
|
5284 |
+
tmp = this.get_node(par, true);
|
5285 |
+
if(tmp && tmp.length) {
|
5286 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5287 |
+
}
|
5288 |
+
}
|
5289 |
+
else {
|
5290 |
+
break;
|
5291 |
+
}
|
5292 |
+
par = this.get_node(par.parent);
|
5293 |
+
}
|
5294 |
+
}
|
5295 |
+
|
5296 |
+
cur = [];
|
5297 |
+
for (i in sel) {
|
5298 |
+
if (sel.hasOwnProperty(i)) {
|
5299 |
+
cur.push(i);
|
5300 |
+
}
|
5301 |
+
}
|
5302 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = cur;
|
5303 |
+
}, this))
|
5304 |
+
.on(this.settings.checkbox.tie_selection ? 'deselect_all.jstree' : 'uncheck_all.jstree', $.proxy(function (e, data) {
|
5305 |
+
var obj = this.get_node($.jstree.root),
|
5306 |
+
m = this._model.data,
|
5307 |
+
i, j, tmp;
|
5308 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
5309 |
+
tmp = m[obj.children_d[i]];
|
5310 |
+
if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {
|
5311 |
+
tmp.original.state.undetermined = false;
|
5312 |
+
}
|
5313 |
+
}
|
5314 |
+
}, this))
|
5315 |
+
.on(this.settings.checkbox.tie_selection ? 'deselect_node.jstree' : 'uncheck_node.jstree', $.proxy(function (e, data) {
|
5316 |
+
var self = this,
|
5317 |
+
obj = data.node,
|
5318 |
+
dom = this.get_node(obj, true),
|
5319 |
+
i, j, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection,
|
5320 |
+
cur = this._data[ t ? 'core' : 'checkbox' ].selected, sel = {},
|
5321 |
+
stillSelectedIds = [],
|
5322 |
+
allIds = obj.children_d.concat(obj.id);
|
5323 |
+
|
5324 |
+
// apply down
|
5325 |
+
if(s.indexOf('down') !== -1) {
|
5326 |
+
var selectedIds = this._cascade_new_checked_state(obj.id, false);
|
5327 |
+
|
5328 |
+
cur = $.vakata.array_filter(cur, function(id) {
|
5329 |
+
return allIds.indexOf(id) === -1 || selectedIds.indexOf(id) > -1;
|
5330 |
+
});
|
5331 |
+
}
|
5332 |
+
|
5333 |
+
// only apply up if cascade up is enabled and if this node is not selected
|
5334 |
+
// (if all child nodes are disabled and cascade_to_disabled === false then this node will till be selected).
|
5335 |
+
if(s.indexOf('up') !== -1 && cur.indexOf(obj.id) === -1) {
|
5336 |
+
for(i = 0, j = obj.parents.length; i < j; i++) {
|
5337 |
+
tmp = this._model.data[obj.parents[i]];
|
5338 |
+
tmp.state[ t ? 'selected' : 'checked' ] = false;
|
5339 |
+
if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) {
|
5340 |
+
tmp.original.state.undetermined = false;
|
5341 |
+
}
|
5342 |
+
tmp = this.get_node(obj.parents[i], true);
|
5343 |
+
if(tmp && tmp.length) {
|
5344 |
+
tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5345 |
+
}
|
5346 |
+
}
|
5347 |
+
|
5348 |
+
cur = $.vakata.array_filter(cur, function(id) {
|
5349 |
+
return obj.parents.indexOf(id) === -1;
|
5350 |
+
});
|
5351 |
+
}
|
5352 |
+
|
5353 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = cur;
|
5354 |
+
}, this));
|
5355 |
+
}
|
5356 |
+
if(this.settings.checkbox.cascade.indexOf('up') !== -1) {
|
5357 |
+
this.element
|
5358 |
+
.on('delete_node.jstree', $.proxy(function (e, data) {
|
5359 |
+
// apply up (whole handler)
|
5360 |
+
var p = this.get_node(data.parent),
|
5361 |
+
m = this._model.data,
|
5362 |
+
i, j, c, tmp, t = this.settings.checkbox.tie_selection;
|
5363 |
+
while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) {
|
5364 |
+
c = 0;
|
5365 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
5366 |
+
c += m[p.children[i]].state[ t ? 'selected' : 'checked' ];
|
5367 |
+
}
|
5368 |
+
if(j > 0 && c === j) {
|
5369 |
+
p.state[ t ? 'selected' : 'checked' ] = true;
|
5370 |
+
this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);
|
5371 |
+
tmp = this.get_node(p, true);
|
5372 |
+
if(tmp && tmp.length) {
|
5373 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5374 |
+
}
|
5375 |
+
}
|
5376 |
+
else {
|
5377 |
+
break;
|
5378 |
+
}
|
5379 |
+
p = this.get_node(p.parent);
|
5380 |
+
}
|
5381 |
+
}, this))
|
5382 |
+
.on('move_node.jstree', $.proxy(function (e, data) {
|
5383 |
+
// apply up (whole handler)
|
5384 |
+
var is_multi = data.is_multi,
|
5385 |
+
old_par = data.old_parent,
|
5386 |
+
new_par = this.get_node(data.parent),
|
5387 |
+
m = this._model.data,
|
5388 |
+
p, c, i, j, tmp, t = this.settings.checkbox.tie_selection;
|
5389 |
+
if(!is_multi) {
|
5390 |
+
p = this.get_node(old_par);
|
5391 |
+
while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) {
|
5392 |
+
c = 0;
|
5393 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
5394 |
+
c += m[p.children[i]].state[ t ? 'selected' : 'checked' ];
|
5395 |
+
}
|
5396 |
+
if(j > 0 && c === j) {
|
5397 |
+
p.state[ t ? 'selected' : 'checked' ] = true;
|
5398 |
+
this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);
|
5399 |
+
tmp = this.get_node(p, true);
|
5400 |
+
if(tmp && tmp.length) {
|
5401 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5402 |
+
}
|
5403 |
+
}
|
5404 |
+
else {
|
5405 |
+
break;
|
5406 |
+
}
|
5407 |
+
p = this.get_node(p.parent);
|
5408 |
+
}
|
5409 |
+
}
|
5410 |
+
p = new_par;
|
5411 |
+
while(p && p.id !== $.jstree.root) {
|
5412 |
+
c = 0;
|
5413 |
+
for(i = 0, j = p.children.length; i < j; i++) {
|
5414 |
+
c += m[p.children[i]].state[ t ? 'selected' : 'checked' ];
|
5415 |
+
}
|
5416 |
+
if(c === j) {
|
5417 |
+
if(!p.state[ t ? 'selected' : 'checked' ]) {
|
5418 |
+
p.state[ t ? 'selected' : 'checked' ] = true;
|
5419 |
+
this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id);
|
5420 |
+
tmp = this.get_node(p, true);
|
5421 |
+
if(tmp && tmp.length) {
|
5422 |
+
tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5423 |
+
}
|
5424 |
+
}
|
5425 |
+
}
|
5426 |
+
else {
|
5427 |
+
if(p.state[ t ? 'selected' : 'checked' ]) {
|
5428 |
+
p.state[ t ? 'selected' : 'checked' ] = false;
|
5429 |
+
this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_remove_item(this._data[ t ? 'core' : 'checkbox' ].selected, p.id);
|
5430 |
+
tmp = this.get_node(p, true);
|
5431 |
+
if(tmp && tmp.length) {
|
5432 |
+
tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5433 |
+
}
|
5434 |
+
}
|
5435 |
+
else {
|
5436 |
+
break;
|
5437 |
+
}
|
5438 |
+
}
|
5439 |
+
p = this.get_node(p.parent);
|
5440 |
+
}
|
5441 |
+
}, this));
|
5442 |
+
}
|
5443 |
+
};
|
5444 |
+
/**
|
5445 |
+
* get an array of all nodes whose state is "undetermined"
|
5446 |
+
* @name get_undetermined([full])
|
5447 |
+
* @param {boolean} full: if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
5448 |
+
* @return {Array}
|
5449 |
+
* @plugin checkbox
|
5450 |
+
*/
|
5451 |
+
this.get_undetermined = function (full) {
|
5452 |
+
if (this.settings.checkbox.cascade.indexOf('undetermined') === -1) {
|
5453 |
+
return [];
|
5454 |
+
}
|
5455 |
+
var i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this, r = [];
|
5456 |
+
for(i = 0, j = s.length; i < j; i++) {
|
5457 |
+
if(m[s[i]] && m[s[i]].parents) {
|
5458 |
+
for(k = 0, l = m[s[i]].parents.length; k < l; k++) {
|
5459 |
+
if(o[m[s[i]].parents[k]] !== undefined) {
|
5460 |
+
break;
|
5461 |
+
}
|
5462 |
+
if(m[s[i]].parents[k] !== $.jstree.root) {
|
5463 |
+
o[m[s[i]].parents[k]] = true;
|
5464 |
+
p.push(m[s[i]].parents[k]);
|
5465 |
+
}
|
5466 |
+
}
|
5467 |
+
}
|
5468 |
+
}
|
5469 |
+
// attempt for server side undetermined state
|
5470 |
+
this.element.find('.jstree-closed').not(':has(.jstree-children)')
|
5471 |
+
.each(function () {
|
5472 |
+
var tmp = tt.get_node(this), tmp2;
|
5473 |
+
|
5474 |
+
if(!tmp) { return; }
|
5475 |
+
|
5476 |
+
if(!tmp.state.loaded) {
|
5477 |
+
if(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) {
|
5478 |
+
if(o[tmp.id] === undefined && tmp.id !== $.jstree.root) {
|
5479 |
+
o[tmp.id] = true;
|
5480 |
+
p.push(tmp.id);
|
5481 |
+
}
|
5482 |
+
for(k = 0, l = tmp.parents.length; k < l; k++) {
|
5483 |
+
if(o[tmp.parents[k]] === undefined && tmp.parents[k] !== $.jstree.root) {
|
5484 |
+
o[tmp.parents[k]] = true;
|
5485 |
+
p.push(tmp.parents[k]);
|
5486 |
+
}
|
5487 |
+
}
|
5488 |
+
}
|
5489 |
+
}
|
5490 |
+
else {
|
5491 |
+
for(i = 0, j = tmp.children_d.length; i < j; i++) {
|
5492 |
+
tmp2 = m[tmp.children_d[i]];
|
5493 |
+
if(!tmp2.state.loaded && tmp2.original && tmp2.original.state && tmp2.original.state.undetermined && tmp2.original.state.undetermined === true) {
|
5494 |
+
if(o[tmp2.id] === undefined && tmp2.id !== $.jstree.root) {
|
5495 |
+
o[tmp2.id] = true;
|
5496 |
+
p.push(tmp2.id);
|
5497 |
+
}
|
5498 |
+
for(k = 0, l = tmp2.parents.length; k < l; k++) {
|
5499 |
+
if(o[tmp2.parents[k]] === undefined && tmp2.parents[k] !== $.jstree.root) {
|
5500 |
+
o[tmp2.parents[k]] = true;
|
5501 |
+
p.push(tmp2.parents[k]);
|
5502 |
+
}
|
5503 |
+
}
|
5504 |
+
}
|
5505 |
+
}
|
5506 |
+
}
|
5507 |
+
});
|
5508 |
+
for (i = 0, j = p.length; i < j; i++) {
|
5509 |
+
if(!m[p[i]].state[ t ? 'selected' : 'checked' ]) {
|
5510 |
+
r.push(full ? m[p[i]] : p[i]);
|
5511 |
+
}
|
5512 |
+
}
|
5513 |
+
return r;
|
5514 |
+
};
|
5515 |
+
/**
|
5516 |
+
* set the undetermined state where and if necessary. Used internally.
|
5517 |
+
* @private
|
5518 |
+
* @name _undetermined()
|
5519 |
+
* @plugin checkbox
|
5520 |
+
*/
|
5521 |
+
this._undetermined = function () {
|
5522 |
+
if(this.element === null) { return; }
|
5523 |
+
var p = this.get_undetermined(false), i, j, s;
|
5524 |
+
|
5525 |
+
this.element.find('.jstree-undetermined').removeClass('jstree-undetermined');
|
5526 |
+
for (i = 0, j = p.length; i < j; i++) {
|
5527 |
+
s = this.get_node(p[i], true);
|
5528 |
+
if(s && s.length) {
|
5529 |
+
s.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined');
|
5530 |
+
}
|
5531 |
+
}
|
5532 |
+
};
|
5533 |
+
this.redraw_node = function(obj, deep, is_callback, force_render) {
|
5534 |
+
obj = parent.redraw_node.apply(this, arguments);
|
5535 |
+
if(obj) {
|
5536 |
+
var i, j, tmp = null, icon = null;
|
5537 |
+
for(i = 0, j = obj.childNodes.length; i < j; i++) {
|
5538 |
+
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
|
5539 |
+
tmp = obj.childNodes[i];
|
5540 |
+
break;
|
5541 |
+
}
|
5542 |
+
}
|
5543 |
+
if(tmp) {
|
5544 |
+
if(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.className += ' jstree-checked'; }
|
5545 |
+
icon = _i.cloneNode(false);
|
5546 |
+
if(this._model.data[obj.id].state.checkbox_disabled) { icon.className += ' jstree-checkbox-disabled'; }
|
5547 |
+
tmp.insertBefore(icon, tmp.childNodes[0]);
|
5548 |
+
}
|
5549 |
+
}
|
5550 |
+
if(!is_callback && this.settings.checkbox.cascade.indexOf('undetermined') !== -1) {
|
5551 |
+
if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }
|
5552 |
+
this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50);
|
5553 |
+
}
|
5554 |
+
return obj;
|
5555 |
+
};
|
5556 |
+
/**
|
5557 |
+
* show the node checkbox icons
|
5558 |
+
* @name show_checkboxes()
|
5559 |
+
* @plugin checkbox
|
5560 |
+
*/
|
5561 |
+
this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass("jstree-no-checkboxes"); };
|
5562 |
+
/**
|
5563 |
+
* hide the node checkbox icons
|
5564 |
+
* @name hide_checkboxes()
|
5565 |
+
* @plugin checkbox
|
5566 |
+
*/
|
5567 |
+
this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass("jstree-no-checkboxes"); };
|
5568 |
+
/**
|
5569 |
+
* toggle the node icons
|
5570 |
+
* @name toggle_checkboxes()
|
5571 |
+
* @plugin checkbox
|
5572 |
+
*/
|
5573 |
+
this.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } };
|
5574 |
+
/**
|
5575 |
+
* checks if a node is in an undetermined state
|
5576 |
+
* @name is_undetermined(obj)
|
5577 |
+
* @param {mixed} obj
|
5578 |
+
* @return {Boolean}
|
5579 |
+
*/
|
5580 |
+
this.is_undetermined = function (obj) {
|
5581 |
+
obj = this.get_node(obj);
|
5582 |
+
var s = this.settings.checkbox.cascade, i, j, t = this.settings.checkbox.tie_selection, d = this._data[ t ? 'core' : 'checkbox' ].selected, m = this._model.data;
|
5583 |
+
if(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 || (s.indexOf('down') === -1 && s.indexOf('up') === -1)) {
|
5584 |
+
return false;
|
5585 |
+
}
|
5586 |
+
if(!obj.state.loaded && obj.original.state.undetermined === true) {
|
5587 |
+
return true;
|
5588 |
+
}
|
5589 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
5590 |
+
if($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children_d[i]].original.state.undetermined)) {
|
5591 |
+
return true;
|
5592 |
+
}
|
5593 |
+
}
|
5594 |
+
return false;
|
5595 |
+
};
|
5596 |
+
/**
|
5597 |
+
* disable a node's checkbox
|
5598 |
+
* @name disable_checkbox(obj)
|
5599 |
+
* @param {mixed} obj an array can be used too
|
5600 |
+
* @trigger disable_checkbox.jstree
|
5601 |
+
* @plugin checkbox
|
5602 |
+
*/
|
5603 |
+
this.disable_checkbox = function (obj) {
|
5604 |
+
var t1, t2, dom;
|
5605 |
+
if($.isArray(obj)) {
|
5606 |
+
obj = obj.slice();
|
5607 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
5608 |
+
this.disable_checkbox(obj[t1]);
|
5609 |
+
}
|
5610 |
+
return true;
|
5611 |
+
}
|
5612 |
+
obj = this.get_node(obj);
|
5613 |
+
if(!obj || obj.id === $.jstree.root) {
|
5614 |
+
return false;
|
5615 |
+
}
|
5616 |
+
dom = this.get_node(obj, true);
|
5617 |
+
if(!obj.state.checkbox_disabled) {
|
5618 |
+
obj.state.checkbox_disabled = true;
|
5619 |
+
if(dom && dom.length) {
|
5620 |
+
dom.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-checkbox-disabled');
|
5621 |
+
}
|
5622 |
+
/**
|
5623 |
+
* triggered when an node's checkbox is disabled
|
5624 |
+
* @event
|
5625 |
+
* @name disable_checkbox.jstree
|
5626 |
+
* @param {Object} node
|
5627 |
+
* @plugin checkbox
|
5628 |
+
*/
|
5629 |
+
this.trigger('disable_checkbox', { 'node' : obj });
|
5630 |
+
}
|
5631 |
+
};
|
5632 |
+
/**
|
5633 |
+
* enable a node's checkbox
|
5634 |
+
* @name enable_checkbox(obj)
|
5635 |
+
* @param {mixed} obj an array can be used too
|
5636 |
+
* @trigger enable_checkbox.jstree
|
5637 |
+
* @plugin checkbox
|
5638 |
+
*/
|
5639 |
+
this.enable_checkbox = function (obj) {
|
5640 |
+
var t1, t2, dom;
|
5641 |
+
if($.isArray(obj)) {
|
5642 |
+
obj = obj.slice();
|
5643 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
5644 |
+
this.enable_checkbox(obj[t1]);
|
5645 |
+
}
|
5646 |
+
return true;
|
5647 |
+
}
|
5648 |
+
obj = this.get_node(obj);
|
5649 |
+
if(!obj || obj.id === $.jstree.root) {
|
5650 |
+
return false;
|
5651 |
+
}
|
5652 |
+
dom = this.get_node(obj, true);
|
5653 |
+
if(obj.state.checkbox_disabled) {
|
5654 |
+
obj.state.checkbox_disabled = false;
|
5655 |
+
if(dom && dom.length) {
|
5656 |
+
dom.children('.jstree-anchor').children('.jstree-checkbox').removeClass('jstree-checkbox-disabled');
|
5657 |
+
}
|
5658 |
+
/**
|
5659 |
+
* triggered when an node's checkbox is enabled
|
5660 |
+
* @event
|
5661 |
+
* @name enable_checkbox.jstree
|
5662 |
+
* @param {Object} node
|
5663 |
+
* @plugin checkbox
|
5664 |
+
*/
|
5665 |
+
this.trigger('enable_checkbox', { 'node' : obj });
|
5666 |
+
}
|
5667 |
+
};
|
5668 |
+
|
5669 |
+
this.activate_node = function (obj, e) {
|
5670 |
+
if($(e.target).hasClass('jstree-checkbox-disabled')) {
|
5671 |
+
return false;
|
5672 |
+
}
|
5673 |
+
if(this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox'))) {
|
5674 |
+
e.ctrlKey = true;
|
5675 |
+
}
|
5676 |
+
if(this.settings.checkbox.tie_selection || (!this.settings.checkbox.whole_node && !$(e.target).hasClass('jstree-checkbox'))) {
|
5677 |
+
return parent.activate_node.call(this, obj, e);
|
5678 |
+
}
|
5679 |
+
if(this.is_disabled(obj)) {
|
5680 |
+
return false;
|
5681 |
+
}
|
5682 |
+
if(this.is_checked(obj)) {
|
5683 |
+
this.uncheck_node(obj, e);
|
5684 |
+
}
|
5685 |
+
else {
|
5686 |
+
this.check_node(obj, e);
|
5687 |
+
}
|
5688 |
+
this.trigger('activate_node', { 'node' : this.get_node(obj) });
|
5689 |
+
};
|
5690 |
+
|
5691 |
+
/**
|
5692 |
+
* Cascades checked state to a node and all its descendants. This function does NOT affect hidden and disabled nodes (or their descendants).
|
5693 |
+
* However if these unaffected nodes are already selected their ids will be included in the returned array.
|
5694 |
+
* @private
|
5695 |
+
* @param {string} id the node ID
|
5696 |
+
* @param {bool} checkedState should the nodes be checked or not
|
5697 |
+
* @returns {Array} Array of all node id's (in this tree branch) that are checked.
|
5698 |
+
*/
|
5699 |
+
this._cascade_new_checked_state = function (id, checkedState) {
|
5700 |
+
var self = this;
|
5701 |
+
var t = this.settings.checkbox.tie_selection;
|
5702 |
+
var node = this._model.data[id];
|
5703 |
+
var selectedNodeIds = [];
|
5704 |
+
var selectedChildrenIds = [], i, j, selectedChildIds;
|
5705 |
+
|
5706 |
+
if (
|
5707 |
+
(this.settings.checkbox.cascade_to_disabled || !node.state.disabled) &&
|
5708 |
+
(this.settings.checkbox.cascade_to_hidden || !node.state.hidden)
|
5709 |
+
) {
|
5710 |
+
//First try and check/uncheck the children
|
5711 |
+
if (node.children) {
|
5712 |
+
for (i = 0, j = node.children.length; i < j; i++) {
|
5713 |
+
var childId = node.children[i];
|
5714 |
+
selectedChildIds = self._cascade_new_checked_state(childId, checkedState);
|
5715 |
+
selectedNodeIds = selectedNodeIds.concat(selectedChildIds);
|
5716 |
+
if (selectedChildIds.indexOf(childId) > -1) {
|
5717 |
+
selectedChildrenIds.push(childId);
|
5718 |
+
}
|
5719 |
+
}
|
5720 |
+
}
|
5721 |
+
|
5722 |
+
var dom = self.get_node(node, true);
|
5723 |
+
|
5724 |
+
//A node's state is undetermined if some but not all of it's children are checked/selected .
|
5725 |
+
var undetermined = selectedChildrenIds.length > 0 && selectedChildrenIds.length < node.children.length;
|
5726 |
+
|
5727 |
+
if(node.original && node.original.state && node.original.state.undetermined) {
|
5728 |
+
node.original.state.undetermined = undetermined;
|
5729 |
+
}
|
5730 |
+
|
5731 |
+
//If a node is undetermined then remove selected class
|
5732 |
+
if (undetermined) {
|
5733 |
+
node.state[ t ? 'selected' : 'checked' ] = false;
|
5734 |
+
dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5735 |
+
}
|
5736 |
+
//Otherwise, if the checkedState === true (i.e. the node is being checked now) and all of the node's children are checked (if it has any children),
|
5737 |
+
//check the node and style it correctly.
|
5738 |
+
else if (checkedState && selectedChildrenIds.length === node.children.length) {
|
5739 |
+
node.state[ t ? 'selected' : 'checked' ] = checkedState;
|
5740 |
+
selectedNodeIds.push(node.id);
|
5741 |
+
|
5742 |
+
dom.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5743 |
+
}
|
5744 |
+
else {
|
5745 |
+
node.state[ t ? 'selected' : 'checked' ] = false;
|
5746 |
+
dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked');
|
5747 |
+
}
|
5748 |
+
}
|
5749 |
+
else {
|
5750 |
+
selectedChildIds = this.get_checked_descendants(id);
|
5751 |
+
|
5752 |
+
if (node.state[ t ? 'selected' : 'checked' ]) {
|
5753 |
+
selectedChildIds.push(node.id);
|
5754 |
+
}
|
5755 |
+
|
5756 |
+
selectedNodeIds = selectedNodeIds.concat(selectedChildIds);
|
5757 |
+
}
|
5758 |
+
|
5759 |
+
return selectedNodeIds;
|
5760 |
+
};
|
5761 |
+
|
5762 |
+
/**
|
5763 |
+
* Gets ids of nodes selected in branch (of tree) specified by id (does not include the node specified by id)
|
5764 |
+
* @name get_checked_descendants(obj)
|
5765 |
+
* @param {string} id the node ID
|
5766 |
+
* @return {Array} array of IDs
|
5767 |
+
* @plugin checkbox
|
5768 |
+
*/
|
5769 |
+
this.get_checked_descendants = function (id) {
|
5770 |
+
var self = this;
|
5771 |
+
var t = self.settings.checkbox.tie_selection;
|
5772 |
+
var node = self._model.data[id];
|
5773 |
+
|
5774 |
+
return $.vakata.array_filter(node.children_d, function(_id) {
|
5775 |
+
return self._model.data[_id].state[ t ? 'selected' : 'checked' ];
|
5776 |
+
});
|
5777 |
+
};
|
5778 |
+
|
5779 |
+
/**
|
5780 |
+
* check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally)
|
5781 |
+
* @name check_node(obj)
|
5782 |
+
* @param {mixed} obj an array can be used to check multiple nodes
|
5783 |
+
* @trigger check_node.jstree
|
5784 |
+
* @plugin checkbox
|
5785 |
+
*/
|
5786 |
+
this.check_node = function (obj, e) {
|
5787 |
+
if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); }
|
5788 |
+
var dom, t1, t2, th;
|
5789 |
+
if($.isArray(obj)) {
|
5790 |
+
obj = obj.slice();
|
5791 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
5792 |
+
this.check_node(obj[t1], e);
|
5793 |
+
}
|
5794 |
+
return true;
|
5795 |
+
}
|
5796 |
+
obj = this.get_node(obj);
|
5797 |
+
if(!obj || obj.id === $.jstree.root) {
|
5798 |
+
return false;
|
5799 |
+
}
|
5800 |
+
dom = this.get_node(obj, true);
|
5801 |
+
if(!obj.state.checked) {
|
5802 |
+
obj.state.checked = true;
|
5803 |
+
this._data.checkbox.selected.push(obj.id);
|
5804 |
+
if(dom && dom.length) {
|
5805 |
+
dom.children('.jstree-anchor').addClass('jstree-checked');
|
5806 |
+
}
|
5807 |
+
/**
|
5808 |
+
* triggered when an node is checked (only if tie_selection in checkbox settings is false)
|
5809 |
+
* @event
|
5810 |
+
* @name check_node.jstree
|
5811 |
+
* @param {Object} node
|
5812 |
+
* @param {Array} selected the current selection
|
5813 |
+
* @param {Object} event the event (if any) that triggered this check_node
|
5814 |
+
* @plugin checkbox
|
5815 |
+
*/
|
5816 |
+
this.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e });
|
5817 |
+
}
|
5818 |
+
};
|
5819 |
+
/**
|
5820 |
+
* uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally)
|
5821 |
+
* @name uncheck_node(obj)
|
5822 |
+
* @param {mixed} obj an array can be used to uncheck multiple nodes
|
5823 |
+
* @trigger uncheck_node.jstree
|
5824 |
+
* @plugin checkbox
|
5825 |
+
*/
|
5826 |
+
this.uncheck_node = function (obj, e) {
|
5827 |
+
if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); }
|
5828 |
+
var t1, t2, dom;
|
5829 |
+
if($.isArray(obj)) {
|
5830 |
+
obj = obj.slice();
|
5831 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
5832 |
+
this.uncheck_node(obj[t1], e);
|
5833 |
+
}
|
5834 |
+
return true;
|
5835 |
+
}
|
5836 |
+
obj = this.get_node(obj);
|
5837 |
+
if(!obj || obj.id === $.jstree.root) {
|
5838 |
+
return false;
|
5839 |
+
}
|
5840 |
+
dom = this.get_node(obj, true);
|
5841 |
+
if(obj.state.checked) {
|
5842 |
+
obj.state.checked = false;
|
5843 |
+
this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id);
|
5844 |
+
if(dom.length) {
|
5845 |
+
dom.children('.jstree-anchor').removeClass('jstree-checked');
|
5846 |
+
}
|
5847 |
+
/**
|
5848 |
+
* triggered when an node is unchecked (only if tie_selection in checkbox settings is false)
|
5849 |
+
* @event
|
5850 |
+
* @name uncheck_node.jstree
|
5851 |
+
* @param {Object} node
|
5852 |
+
* @param {Array} selected the current selection
|
5853 |
+
* @param {Object} event the event (if any) that triggered this uncheck_node
|
5854 |
+
* @plugin checkbox
|
5855 |
+
*/
|
5856 |
+
this.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e });
|
5857 |
+
}
|
5858 |
+
};
|
5859 |
+
|
5860 |
+
/**
|
5861 |
+
* checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally)
|
5862 |
+
* @name check_all()
|
5863 |
+
* @trigger check_all.jstree, changed.jstree
|
5864 |
+
* @plugin checkbox
|
5865 |
+
*/
|
5866 |
+
this.check_all = function () {
|
5867 |
+
if(this.settings.checkbox.tie_selection) { return this.select_all(); }
|
5868 |
+
var tmp = this._data.checkbox.selected.concat([]), i, j;
|
5869 |
+
this._data.checkbox.selected = this._model.data[$.jstree.root].children_d.concat();
|
5870 |
+
for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) {
|
5871 |
+
if(this._model.data[this._data.checkbox.selected[i]]) {
|
5872 |
+
this._model.data[this._data.checkbox.selected[i]].state.checked = true;
|
5873 |
+
}
|
5874 |
+
}
|
5875 |
+
this.redraw(true);
|
5876 |
+
/**
|
5877 |
+
* triggered when all nodes are checked (only if tie_selection in checkbox settings is false)
|
5878 |
+
* @event
|
5879 |
+
* @name check_all.jstree
|
5880 |
+
* @param {Array} selected the current selection
|
5881 |
+
* @plugin checkbox
|
5882 |
+
*/
|
5883 |
+
this.trigger('check_all', { 'selected' : this._data.checkbox.selected });
|
5884 |
+
};
|
5885 |
+
/**
|
5886 |
+
* uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally)
|
5887 |
+
* @name uncheck_all()
|
5888 |
+
* @trigger uncheck_all.jstree
|
5889 |
+
* @plugin checkbox
|
5890 |
+
*/
|
5891 |
+
this.uncheck_all = function () {
|
5892 |
+
if(this.settings.checkbox.tie_selection) { return this.deselect_all(); }
|
5893 |
+
var tmp = this._data.checkbox.selected.concat([]), i, j;
|
5894 |
+
for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) {
|
5895 |
+
if(this._model.data[this._data.checkbox.selected[i]]) {
|
5896 |
+
this._model.data[this._data.checkbox.selected[i]].state.checked = false;
|
5897 |
+
}
|
5898 |
+
}
|
5899 |
+
this._data.checkbox.selected = [];
|
5900 |
+
this.element.find('.jstree-checked').removeClass('jstree-checked');
|
5901 |
+
/**
|
5902 |
+
* triggered when all nodes are unchecked (only if tie_selection in checkbox settings is false)
|
5903 |
+
* @event
|
5904 |
+
* @name uncheck_all.jstree
|
5905 |
+
* @param {Object} node the previous selection
|
5906 |
+
* @param {Array} selected the current selection
|
5907 |
+
* @plugin checkbox
|
5908 |
+
*/
|
5909 |
+
this.trigger('uncheck_all', { 'selected' : this._data.checkbox.selected, 'node' : tmp });
|
5910 |
+
};
|
5911 |
+
/**
|
5912 |
+
* checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected)
|
5913 |
+
* @name is_checked(obj)
|
5914 |
+
* @param {mixed} obj
|
5915 |
+
* @return {Boolean}
|
5916 |
+
* @plugin checkbox
|
5917 |
+
*/
|
5918 |
+
this.is_checked = function (obj) {
|
5919 |
+
if(this.settings.checkbox.tie_selection) { return this.is_selected(obj); }
|
5920 |
+
obj = this.get_node(obj);
|
5921 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
5922 |
+
return obj.state.checked;
|
5923 |
+
};
|
5924 |
+
/**
|
5925 |
+
* get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected)
|
5926 |
+
* @name get_checked([full])
|
5927 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
5928 |
+
* @return {Array}
|
5929 |
+
* @plugin checkbox
|
5930 |
+
*/
|
5931 |
+
this.get_checked = function (full) {
|
5932 |
+
if(this.settings.checkbox.tie_selection) { return this.get_selected(full); }
|
5933 |
+
return full ? $.map(this._data.checkbox.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.checkbox.selected.slice();
|
5934 |
+
};
|
5935 |
+
/**
|
5936 |
+
* get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected)
|
5937 |
+
* @name get_top_checked([full])
|
5938 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
5939 |
+
* @return {Array}
|
5940 |
+
* @plugin checkbox
|
5941 |
+
*/
|
5942 |
+
this.get_top_checked = function (full) {
|
5943 |
+
if(this.settings.checkbox.tie_selection) { return this.get_top_selected(full); }
|
5944 |
+
var tmp = this.get_checked(true),
|
5945 |
+
obj = {}, i, j, k, l;
|
5946 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
5947 |
+
obj[tmp[i].id] = tmp[i];
|
5948 |
+
}
|
5949 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
5950 |
+
for(k = 0, l = tmp[i].children_d.length; k < l; k++) {
|
5951 |
+
if(obj[tmp[i].children_d[k]]) {
|
5952 |
+
delete obj[tmp[i].children_d[k]];
|
5953 |
+
}
|
5954 |
+
}
|
5955 |
+
}
|
5956 |
+
tmp = [];
|
5957 |
+
for(i in obj) {
|
5958 |
+
if(obj.hasOwnProperty(i)) {
|
5959 |
+
tmp.push(i);
|
5960 |
+
}
|
5961 |
+
}
|
5962 |
+
return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp;
|
5963 |
+
};
|
5964 |
+
/**
|
5965 |
+
* get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected)
|
5966 |
+
* @name get_bottom_checked([full])
|
5967 |
+
* @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned
|
5968 |
+
* @return {Array}
|
5969 |
+
* @plugin checkbox
|
5970 |
+
*/
|
5971 |
+
this.get_bottom_checked = function (full) {
|
5972 |
+
if(this.settings.checkbox.tie_selection) { return this.get_bottom_selected(full); }
|
5973 |
+
var tmp = this.get_checked(true),
|
5974 |
+
obj = [], i, j;
|
5975 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
5976 |
+
if(!tmp[i].children.length) {
|
5977 |
+
obj.push(tmp[i].id);
|
5978 |
+
}
|
5979 |
+
}
|
5980 |
+
return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj;
|
5981 |
+
};
|
5982 |
+
this.load_node = function (obj, callback) {
|
5983 |
+
var k, l, i, j, c, tmp;
|
5984 |
+
if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) {
|
5985 |
+
tmp = this.get_node(obj);
|
5986 |
+
if(tmp && tmp.state.loaded) {
|
5987 |
+
for(k = 0, l = tmp.children_d.length; k < l; k++) {
|
5988 |
+
if(this._model.data[tmp.children_d[k]].state.checked) {
|
5989 |
+
c = true;
|
5990 |
+
this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, tmp.children_d[k]);
|
5991 |
+
}
|
5992 |
+
}
|
5993 |
+
}
|
5994 |
+
}
|
5995 |
+
return parent.load_node.apply(this, arguments);
|
5996 |
+
};
|
5997 |
+
this.get_state = function () {
|
5998 |
+
var state = parent.get_state.apply(this, arguments);
|
5999 |
+
if(this.settings.checkbox.tie_selection) { return state; }
|
6000 |
+
state.checkbox = this._data.checkbox.selected.slice();
|
6001 |
+
return state;
|
6002 |
+
};
|
6003 |
+
this.set_state = function (state, callback) {
|
6004 |
+
var res = parent.set_state.apply(this, arguments);
|
6005 |
+
if(res && state.checkbox) {
|
6006 |
+
if(!this.settings.checkbox.tie_selection) {
|
6007 |
+
this.uncheck_all();
|
6008 |
+
var _this = this;
|
6009 |
+
$.each(state.checkbox, function (i, v) {
|
6010 |
+
_this.check_node(v);
|
6011 |
+
});
|
6012 |
+
}
|
6013 |
+
delete state.checkbox;
|
6014 |
+
this.set_state(state, callback);
|
6015 |
+
return false;
|
6016 |
+
}
|
6017 |
+
return res;
|
6018 |
+
};
|
6019 |
+
this.refresh = function (skip_loading, forget_state) {
|
6020 |
+
if(this.settings.checkbox.tie_selection) {
|
6021 |
+
this._data.checkbox.selected = [];
|
6022 |
+
}
|
6023 |
+
return parent.refresh.apply(this, arguments);
|
6024 |
+
};
|
6025 |
+
};
|
6026 |
+
|
6027 |
+
// include the checkbox plugin by default
|
6028 |
+
// $.jstree.defaults.plugins.push("checkbox");
|
6029 |
+
|
6030 |
+
|
6031 |
+
/**
|
6032 |
+
* ### Conditionalselect plugin
|
6033 |
+
*
|
6034 |
+
* This plugin allows defining a callback to allow or deny node selection by user input (activate node method).
|
6035 |
+
*/
|
6036 |
+
|
6037 |
+
/**
|
6038 |
+
* a callback (function) which is invoked in the instance's scope and receives two arguments - the node and the event that triggered the `activate_node` call. Returning false prevents working with the node, returning true allows invoking activate_node. Defaults to returning `true`.
|
6039 |
+
* @name $.jstree.defaults.checkbox.visible
|
6040 |
+
* @plugin checkbox
|
6041 |
+
*/
|
6042 |
+
$.jstree.defaults.conditionalselect = function () { return true; };
|
6043 |
+
$.jstree.plugins.conditionalselect = function (options, parent) {
|
6044 |
+
// own function
|
6045 |
+
this.activate_node = function (obj, e) {
|
6046 |
+
if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) {
|
6047 |
+
return parent.activate_node.call(this, obj, e);
|
6048 |
+
}
|
6049 |
+
};
|
6050 |
+
};
|
6051 |
+
|
6052 |
+
|
6053 |
+
/**
|
6054 |
+
* ### Contextmenu plugin
|
6055 |
+
*
|
6056 |
+
* Shows a context menu when a node is right-clicked.
|
6057 |
+
*/
|
6058 |
+
|
6059 |
+
/**
|
6060 |
+
* stores all defaults for the contextmenu plugin
|
6061 |
+
* @name $.jstree.defaults.contextmenu
|
6062 |
+
* @plugin contextmenu
|
6063 |
+
*/
|
6064 |
+
$.jstree.defaults.contextmenu = {
|
6065 |
+
/**
|
6066 |
+
* a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`.
|
6067 |
+
* @name $.jstree.defaults.contextmenu.select_node
|
6068 |
+
* @plugin contextmenu
|
6069 |
+
*/
|
6070 |
+
select_node : true,
|
6071 |
+
/**
|
6072 |
+
* a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used.
|
6073 |
+
* @name $.jstree.defaults.contextmenu.show_at_node
|
6074 |
+
* @plugin contextmenu
|
6075 |
+
*/
|
6076 |
+
show_at_node : true,
|
6077 |
+
/**
|
6078 |
+
* an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too).
|
6079 |
+
*
|
6080 |
+
* Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu.
|
6081 |
+
*
|
6082 |
+
* * `separator_before` - a boolean indicating if there should be a separator before this item
|
6083 |
+
* * `separator_after` - a boolean indicating if there should be a separator after this item
|
6084 |
+
* * `_disabled` - a boolean indicating if this action should be disabled
|
6085 |
+
* * `label` - a string - the name of the action (could be a function returning a string)
|
6086 |
+
* * `title` - a string - an optional tooltip for the item
|
6087 |
+
* * `action` - a function to be executed if this item is chosen, the function will receive
|
6088 |
+
* * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class
|
6089 |
+
* * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2)
|
6090 |
+
* * `shortcut_label` - shortcut label (like for example `F2` for rename)
|
6091 |
+
* * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered
|
6092 |
+
*
|
6093 |
+
* @name $.jstree.defaults.contextmenu.items
|
6094 |
+
* @plugin contextmenu
|
6095 |
+
*/
|
6096 |
+
items : function (o, cb) { // Could be an object directly
|
6097 |
+
return {
|
6098 |
+
"create" : {
|
6099 |
+
"separator_before" : false,
|
6100 |
+
"separator_after" : true,
|
6101 |
+
"_disabled" : false, //(this.check("create_node", data.reference, {}, "last")),
|
6102 |
+
"label" : "Create",
|
6103 |
+
"action" : function (data) {
|
6104 |
+
var inst = $.jstree.reference(data.reference),
|
6105 |
+
obj = inst.get_node(data.reference);
|
6106 |
+
inst.create_node(obj, {}, "last", function (new_node) {
|
6107 |
+
try {
|
6108 |
+
inst.edit(new_node);
|
6109 |
+
} catch (ex) {
|
6110 |
+
setTimeout(function () { inst.edit(new_node); },0);
|
6111 |
+
}
|
6112 |
+
});
|
6113 |
+
}
|
6114 |
+
},
|
6115 |
+
"rename" : {
|
6116 |
+
"separator_before" : false,
|
6117 |
+
"separator_after" : false,
|
6118 |
+
"_disabled" : false, //(this.check("rename_node", data.reference, this.get_parent(data.reference), "")),
|
6119 |
+
"label" : "Rename",
|
6120 |
+
/*!
|
6121 |
+
"shortcut" : 113,
|
6122 |
+
"shortcut_label" : 'F2',
|
6123 |
+
"icon" : "glyphicon glyphicon-leaf",
|
6124 |
+
*/
|
6125 |
+
"action" : function (data) {
|
6126 |
+
var inst = $.jstree.reference(data.reference),
|
6127 |
+
obj = inst.get_node(data.reference);
|
6128 |
+
inst.edit(obj);
|
6129 |
+
}
|
6130 |
+
},
|
6131 |
+
"remove" : {
|
6132 |
+
"separator_before" : false,
|
6133 |
+
"icon" : false,
|
6134 |
+
"separator_after" : false,
|
6135 |
+
"_disabled" : false, //(this.check("delete_node", data.reference, this.get_parent(data.reference), "")),
|
6136 |
+
"label" : "Delete",
|
6137 |
+
"action" : function (data) {
|
6138 |
+
var inst = $.jstree.reference(data.reference),
|
6139 |
+
obj = inst.get_node(data.reference);
|
6140 |
+
if(inst.is_selected(obj)) {
|
6141 |
+
inst.delete_node(inst.get_selected());
|
6142 |
+
}
|
6143 |
+
else {
|
6144 |
+
inst.delete_node(obj);
|
6145 |
+
}
|
6146 |
+
}
|
6147 |
+
},
|
6148 |
+
"ccp" : {
|
6149 |
+
"separator_before" : true,
|
6150 |
+
"icon" : false,
|
6151 |
+
"separator_after" : false,
|
6152 |
+
"label" : "Edit",
|
6153 |
+
"action" : false,
|
6154 |
+
"submenu" : {
|
6155 |
+
"cut" : {
|
6156 |
+
"separator_before" : false,
|
6157 |
+
"separator_after" : false,
|
6158 |
+
"label" : "Cut",
|
6159 |
+
"action" : function (data) {
|
6160 |
+
var inst = $.jstree.reference(data.reference),
|
6161 |
+
obj = inst.get_node(data.reference);
|
6162 |
+
if(inst.is_selected(obj)) {
|
6163 |
+
inst.cut(inst.get_top_selected());
|
6164 |
+
}
|
6165 |
+
else {
|
6166 |
+
inst.cut(obj);
|
6167 |
+
}
|
6168 |
+
}
|
6169 |
+
},
|
6170 |
+
"copy" : {
|
6171 |
+
"separator_before" : false,
|
6172 |
+
"icon" : false,
|
6173 |
+
"separator_after" : false,
|
6174 |
+
"label" : "Copy",
|
6175 |
+
"action" : function (data) {
|
6176 |
+
var inst = $.jstree.reference(data.reference),
|
6177 |
+
obj = inst.get_node(data.reference);
|
6178 |
+
if(inst.is_selected(obj)) {
|
6179 |
+
inst.copy(inst.get_top_selected());
|
6180 |
+
}
|
6181 |
+
else {
|
6182 |
+
inst.copy(obj);
|
6183 |
+
}
|
6184 |
+
}
|
6185 |
+
},
|
6186 |
+
"paste" : {
|
6187 |
+
"separator_before" : false,
|
6188 |
+
"icon" : false,
|
6189 |
+
"_disabled" : function (data) {
|
6190 |
+
return !$.jstree.reference(data.reference).can_paste();
|
6191 |
+
},
|
6192 |
+
"separator_after" : false,
|
6193 |
+
"label" : "Paste",
|
6194 |
+
"action" : function (data) {
|
6195 |
+
var inst = $.jstree.reference(data.reference),
|
6196 |
+
obj = inst.get_node(data.reference);
|
6197 |
+
inst.paste(obj);
|
6198 |
+
}
|
6199 |
+
}
|
6200 |
+
}
|
6201 |
+
}
|
6202 |
+
};
|
6203 |
+
}
|
6204 |
+
};
|
6205 |
+
|
6206 |
+
$.jstree.plugins.contextmenu = function (options, parent) {
|
6207 |
+
this.bind = function () {
|
6208 |
+
parent.bind.call(this);
|
6209 |
+
|
6210 |
+
var last_ts = 0, cto = null, ex, ey;
|
6211 |
+
this.element
|
6212 |
+
.on("init.jstree loading.jstree ready.jstree", $.proxy(function () {
|
6213 |
+
this.get_container_ul().addClass('jstree-contextmenu');
|
6214 |
+
}, this))
|
6215 |
+
.on("contextmenu.jstree", ".jstree-anchor", $.proxy(function (e, data) {
|
6216 |
+
if (e.target.tagName.toLowerCase() === 'input') {
|
6217 |
+
return;
|
6218 |
+
}
|
6219 |
+
e.preventDefault();
|
6220 |
+
last_ts = e.ctrlKey ? +new Date() : 0;
|
6221 |
+
if(data || cto) {
|
6222 |
+
last_ts = (+new Date()) + 10000;
|
6223 |
+
}
|
6224 |
+
if(cto) {
|
6225 |
+
clearTimeout(cto);
|
6226 |
+
}
|
6227 |
+
if(!this.is_loading(e.currentTarget)) {
|
6228 |
+
this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e);
|
6229 |
+
}
|
6230 |
+
}, this))
|
6231 |
+
.on("click.jstree", ".jstree-anchor", $.proxy(function (e) {
|
6232 |
+
if(this._data.contextmenu.visible && (!last_ts || (+new Date()) - last_ts > 250)) { // work around safari & macOS ctrl+click
|
6233 |
+
$.vakata.context.hide();
|
6234 |
+
}
|
6235 |
+
last_ts = 0;
|
6236 |
+
}, this))
|
6237 |
+
.on("touchstart.jstree", ".jstree-anchor", function (e) {
|
6238 |
+
if(!e.originalEvent || !e.originalEvent.changedTouches || !e.originalEvent.changedTouches[0]) {
|
6239 |
+
return;
|
6240 |
+
}
|
6241 |
+
ex = e.originalEvent.changedTouches[0].clientX;
|
6242 |
+
ey = e.originalEvent.changedTouches[0].clientY;
|
6243 |
+
cto = setTimeout(function () {
|
6244 |
+
$(e.currentTarget).trigger('contextmenu', true);
|
6245 |
+
}, 750);
|
6246 |
+
})
|
6247 |
+
.on('touchmove.vakata.jstree', function (e) {
|
6248 |
+
if(cto && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0] && (Math.abs(ex - e.originalEvent.changedTouches[0].clientX) > 10 || Math.abs(ey - e.originalEvent.changedTouches[0].clientY) > 10)) {
|
6249 |
+
clearTimeout(cto);
|
6250 |
+
$.vakata.context.hide();
|
6251 |
+
}
|
6252 |
+
})
|
6253 |
+
.on('touchend.vakata.jstree', function (e) {
|
6254 |
+
if(cto) {
|
6255 |
+
clearTimeout(cto);
|
6256 |
+
}
|
6257 |
+
});
|
6258 |
+
|
6259 |
+
/*!
|
6260 |
+
if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) {
|
6261 |
+
var el = null, tm = null;
|
6262 |
+
this.element
|
6263 |
+
.on("touchstart", ".jstree-anchor", function (e) {
|
6264 |
+
el = e.currentTarget;
|
6265 |
+
tm = +new Date();
|
6266 |
+
$(document).one("touchend", function (e) {
|
6267 |
+
e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset);
|
6268 |
+
e.currentTarget = e.target;
|
6269 |
+
tm = ((+(new Date())) - tm);
|
6270 |
+
if(e.target === el && tm > 600 && tm < 1000) {
|
6271 |
+
e.preventDefault();
|
6272 |
+
$(el).trigger('contextmenu', e);
|
6273 |
+
}
|
6274 |
+
el = null;
|
6275 |
+
tm = null;
|
6276 |
+
});
|
6277 |
+
});
|
6278 |
+
}
|
6279 |
+
*/
|
6280 |
+
$(document).on("context_hide.vakata.jstree", $.proxy(function (e, data) {
|
6281 |
+
this._data.contextmenu.visible = false;
|
6282 |
+
$(data.reference).removeClass('jstree-context');
|
6283 |
+
}, this));
|
6284 |
+
};
|
6285 |
+
this.teardown = function () {
|
6286 |
+
if(this._data.contextmenu.visible) {
|
6287 |
+
$.vakata.context.hide();
|
6288 |
+
}
|
6289 |
+
parent.teardown.call(this);
|
6290 |
+
};
|
6291 |
+
|
6292 |
+
/**
|
6293 |
+
* prepare and show the context menu for a node
|
6294 |
+
* @name show_contextmenu(obj [, x, y])
|
6295 |
+
* @param {mixed} obj the node
|
6296 |
+
* @param {Number} x the x-coordinate relative to the document to show the menu at
|
6297 |
+
* @param {Number} y the y-coordinate relative to the document to show the menu at
|
6298 |
+
* @param {Object} e the event if available that triggered the contextmenu
|
6299 |
+
* @plugin contextmenu
|
6300 |
+
* @trigger show_contextmenu.jstree
|
6301 |
+
*/
|
6302 |
+
this.show_contextmenu = function (obj, x, y, e) {
|
6303 |
+
obj = this.get_node(obj);
|
6304 |
+
if(!obj || obj.id === $.jstree.root) { return false; }
|
6305 |
+
var s = this.settings.contextmenu,
|
6306 |
+
d = this.get_node(obj, true),
|
6307 |
+
a = d.children(".jstree-anchor"),
|
6308 |
+
o = false,
|
6309 |
+
i = false;
|
6310 |
+
if(s.show_at_node || x === undefined || y === undefined) {
|
6311 |
+
o = a.offset();
|
6312 |
+
x = o.left;
|
6313 |
+
y = o.top + this._data.core.li_height;
|
6314 |
+
}
|
6315 |
+
if(this.settings.contextmenu.select_node && !this.is_selected(obj)) {
|
6316 |
+
this.activate_node(obj, e);
|
6317 |
+
}
|
6318 |
+
|
6319 |
+
i = s.items;
|
6320 |
+
if($.isFunction(i)) {
|
6321 |
+
i = i.call(this, obj, $.proxy(function (i) {
|
6322 |
+
this._show_contextmenu(obj, x, y, i);
|
6323 |
+
}, this));
|
6324 |
+
}
|
6325 |
+
if($.isPlainObject(i)) {
|
6326 |
+
this._show_contextmenu(obj, x, y, i);
|
6327 |
+
}
|
6328 |
+
};
|
6329 |
+
/**
|
6330 |
+
* show the prepared context menu for a node
|
6331 |
+
* @name _show_contextmenu(obj, x, y, i)
|
6332 |
+
* @param {mixed} obj the node
|
6333 |
+
* @param {Number} x the x-coordinate relative to the document to show the menu at
|
6334 |
+
* @param {Number} y the y-coordinate relative to the document to show the menu at
|
6335 |
+
* @param {Number} i the object of items to show
|
6336 |
+
* @plugin contextmenu
|
6337 |
+
* @trigger show_contextmenu.jstree
|
6338 |
+
* @private
|
6339 |
+
*/
|
6340 |
+
this._show_contextmenu = function (obj, x, y, i) {
|
6341 |
+
var d = this.get_node(obj, true),
|
6342 |
+
a = d.children(".jstree-anchor");
|
6343 |
+
$(document).one("context_show.vakata.jstree", $.proxy(function (e, data) {
|
6344 |
+
var cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu';
|
6345 |
+
$(data.element).addClass(cls);
|
6346 |
+
a.addClass('jstree-context');
|
6347 |
+
}, this));
|
6348 |
+
this._data.contextmenu.visible = true;
|
6349 |
+
$.vakata.context.show(a, { 'x' : x, 'y' : y }, i);
|
6350 |
+
/**
|
6351 |
+
* triggered when the contextmenu is shown for a node
|
6352 |
+
* @event
|
6353 |
+
* @name show_contextmenu.jstree
|
6354 |
+
* @param {Object} node the node
|
6355 |
+
* @param {Number} x the x-coordinate of the menu relative to the document
|
6356 |
+
* @param {Number} y the y-coordinate of the menu relative to the document
|
6357 |
+
* @plugin contextmenu
|
6358 |
+
*/
|
6359 |
+
this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y });
|
6360 |
+
};
|
6361 |
+
};
|
6362 |
+
|
6363 |
+
// contextmenu helper
|
6364 |
+
(function ($) {
|
6365 |
+
var right_to_left = false,
|
6366 |
+
vakata_context = {
|
6367 |
+
element : false,
|
6368 |
+
reference : false,
|
6369 |
+
position_x : 0,
|
6370 |
+
position_y : 0,
|
6371 |
+
items : [],
|
6372 |
+
html : "",
|
6373 |
+
is_visible : false
|
6374 |
+
};
|
6375 |
+
|
6376 |
+
$.vakata.context = {
|
6377 |
+
settings : {
|
6378 |
+
hide_onmouseleave : 0,
|
6379 |
+
icons : true
|
6380 |
+
},
|
6381 |
+
_trigger : function (event_name) {
|
6382 |
+
$(document).triggerHandler("context_" + event_name + ".vakata", {
|
6383 |
+
"reference" : vakata_context.reference,
|
6384 |
+
"element" : vakata_context.element,
|
6385 |
+
"position" : {
|
6386 |
+
"x" : vakata_context.position_x,
|
6387 |
+
"y" : vakata_context.position_y
|
6388 |
+
}
|
6389 |
+
});
|
6390 |
+
},
|
6391 |
+
_execute : function (i) {
|
6392 |
+
i = vakata_context.items[i];
|
6393 |
+
return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, {
|
6394 |
+
"item" : i,
|
6395 |
+
"reference" : vakata_context.reference,
|
6396 |
+
"element" : vakata_context.element,
|
6397 |
+
"position" : {
|
6398 |
+
"x" : vakata_context.position_x,
|
6399 |
+
"y" : vakata_context.position_y
|
6400 |
+
}
|
6401 |
+
}) : false;
|
6402 |
+
},
|
6403 |
+
_parse : function (o, is_callback) {
|
6404 |
+
if(!o) { return false; }
|
6405 |
+
if(!is_callback) {
|
6406 |
+
vakata_context.html = "";
|
6407 |
+
vakata_context.items = [];
|
6408 |
+
}
|
6409 |
+
var str = "",
|
6410 |
+
sep = false,
|
6411 |
+
tmp;
|
6412 |
+
|
6413 |
+
if(is_callback) { str += "<"+"ul>"; }
|
6414 |
+
$.each(o, function (i, val) {
|
6415 |
+
if(!val) { return true; }
|
6416 |
+
vakata_context.items.push(val);
|
6417 |
+
if(!sep && val.separator_before) {
|
6418 |
+
str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>";
|
6419 |
+
}
|
6420 |
+
sep = false;
|
6421 |
+
str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">";
|
6422 |
+
str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">";
|
6423 |
+
if($.vakata.context.settings.icons) {
|
6424 |
+
str += "<"+"i ";
|
6425 |
+
if(val.icon) {
|
6426 |
+
if(val.icon.indexOf("/") !== -1 || val.icon.indexOf(".") !== -1) { str += " style='background:url(\"" + val.icon + "\") center center no-repeat' "; }
|
6427 |
+
else { str += " class='" + val.icon + "' "; }
|
6428 |
+
}
|
6429 |
+
str += "><"+"/i><"+"span class='vakata-contextmenu-sep'> <"+"/span>";
|
6430 |
+
}
|
6431 |
+
str += ($.isFunction(val.label) ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+val.shortcut+'">'+ (val.shortcut_label || '') +'</span>':'') + "<"+"/a>";
|
6432 |
+
if(val.submenu) {
|
6433 |
+
tmp = $.vakata.context._parse(val.submenu, true);
|
6434 |
+
if(tmp) { str += tmp; }
|
6435 |
+
}
|
6436 |
+
str += "<"+"/li>";
|
6437 |
+
if(val.separator_after) {
|
6438 |
+
str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>";
|
6439 |
+
sep = true;
|
6440 |
+
}
|
6441 |
+
});
|
6442 |
+
str = str.replace(/<li class\='vakata-context-separator'\><\/li\>$/,"");
|
6443 |
+
if(is_callback) { str += "</ul>"; }
|
6444 |
+
/**
|
6445 |
+
* triggered on the document when the contextmenu is parsed (HTML is built)
|
6446 |
+
* @event
|
6447 |
+
* @plugin contextmenu
|
6448 |
+
* @name context_parse.vakata
|
6449 |
+
* @param {jQuery} reference the element that was right clicked
|
6450 |
+
* @param {jQuery} element the DOM element of the menu itself
|
6451 |
+
* @param {Object} position the x & y coordinates of the menu
|
6452 |
+
*/
|
6453 |
+
if(!is_callback) { vakata_context.html = str; $.vakata.context._trigger("parse"); }
|
6454 |
+
return str.length > 10 ? str : false;
|
6455 |
+
},
|
6456 |
+
_show_submenu : function (o) {
|
6457 |
+
o = $(o);
|
6458 |
+
if(!o.length || !o.children("ul").length) { return; }
|
6459 |
+
var e = o.children("ul"),
|
6460 |
+
xl = o.offset().left,
|
6461 |
+
x = xl + o.outerWidth(),
|
6462 |
+
y = o.offset().top,
|
6463 |
+
w = e.width(),
|
6464 |
+
h = e.height(),
|
6465 |
+
dw = $(window).width() + $(window).scrollLeft(),
|
6466 |
+
dh = $(window).height() + $(window).scrollTop();
|
6467 |
+
// може да се спести е една проверка - дали няма някой от класовете вече нагоре
|
6468 |
+
if(right_to_left) {
|
6469 |
+
o[x - (w + 10 + o.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left");
|
6470 |
+
}
|
6471 |
+
else {
|
6472 |
+
o[x + w > dw && xl > dw - x ? "addClass" : "removeClass"]("vakata-context-right");
|
6473 |
+
}
|
6474 |
+
if(y + h + 10 > dh) {
|
6475 |
+
e.css("bottom","-1px");
|
6476 |
+
}
|
6477 |
+
|
6478 |
+
//if does not fit - stick it to the side
|
6479 |
+
if (o.hasClass('vakata-context-right')) {
|
6480 |
+
if (xl < w) {
|
6481 |
+
e.css("margin-right", xl - w);
|
6482 |
+
}
|
6483 |
+
} else {
|
6484 |
+
if (dw - x < w) {
|
6485 |
+
e.css("margin-left", dw - x - w);
|
6486 |
+
}
|
6487 |
+
}
|
6488 |
+
|
6489 |
+
e.show();
|
6490 |
+
},
|
6491 |
+
show : function (reference, position, data) {
|
6492 |
+
var o, e, x, y, w, h, dw, dh, cond = true;
|
6493 |
+
if(vakata_context.element && vakata_context.element.length) {
|
6494 |
+
vakata_context.element.width('');
|
6495 |
+
}
|
6496 |
+
switch(cond) {
|
6497 |
+
case (!position && !reference):
|
6498 |
+
return false;
|
6499 |
+
case (!!position && !!reference):
|
6500 |
+
vakata_context.reference = reference;
|
6501 |
+
vakata_context.position_x = position.x;
|
6502 |
+
vakata_context.position_y = position.y;
|
6503 |
+
break;
|
6504 |
+
case (!position && !!reference):
|
6505 |
+
vakata_context.reference = reference;
|
6506 |
+
o = reference.offset();
|
6507 |
+
vakata_context.position_x = o.left + reference.outerHeight();
|
6508 |
+
vakata_context.position_y = o.top;
|
6509 |
+
break;
|
6510 |
+
case (!!position && !reference):
|
6511 |
+
vakata_context.position_x = position.x;
|
6512 |
+
vakata_context.position_y = position.y;
|
6513 |
+
break;
|
6514 |
+
}
|
6515 |
+
if(!!reference && !data && $(reference).data('vakata_contextmenu')) {
|
6516 |
+
data = $(reference).data('vakata_contextmenu');
|
6517 |
+
}
|
6518 |
+
if($.vakata.context._parse(data)) {
|
6519 |
+
vakata_context.element.html(vakata_context.html);
|
6520 |
+
}
|
6521 |
+
if(vakata_context.items.length) {
|
6522 |
+
vakata_context.element.appendTo(document.body);
|
6523 |
+
e = vakata_context.element;
|
6524 |
+
x = vakata_context.position_x;
|
6525 |
+
y = vakata_context.position_y;
|
6526 |
+
w = e.width();
|
6527 |
+
h = e.height();
|
6528 |
+
dw = $(window).width() + $(window).scrollLeft();
|
6529 |
+
dh = $(window).height() + $(window).scrollTop();
|
6530 |
+
if(right_to_left) {
|
6531 |
+
x -= (e.outerWidth() - $(reference).outerWidth());
|
6532 |
+
if(x < $(window).scrollLeft() + 20) {
|
6533 |
+
x = $(window).scrollLeft() + 20;
|
6534 |
+
}
|
6535 |
+
}
|
6536 |
+
if(x + w + 20 > dw) {
|
6537 |
+
x = dw - (w + 20);
|
6538 |
+
}
|
6539 |
+
if(y + h + 20 > dh) {
|
6540 |
+
y = dh - (h + 20);
|
6541 |
+
}
|
6542 |
+
|
6543 |
+
vakata_context.element
|
6544 |
+
.css({ "left" : x, "top" : y })
|
6545 |
+
.show()
|
6546 |
+
.find('a').first().focus().parent().addClass("vakata-context-hover");
|
6547 |
+
vakata_context.is_visible = true;
|
6548 |
+
/**
|
6549 |
+
* triggered on the document when the contextmenu is shown
|
6550 |
+
* @event
|
6551 |
+
* @plugin contextmenu
|
6552 |
+
* @name context_show.vakata
|
6553 |
+
* @param {jQuery} reference the element that was right clicked
|
6554 |
+
* @param {jQuery} element the DOM element of the menu itself
|
6555 |
+
* @param {Object} position the x & y coordinates of the menu
|
6556 |
+
*/
|
6557 |
+
$.vakata.context._trigger("show");
|
6558 |
+
}
|
6559 |
+
},
|
6560 |
+
hide : function () {
|
6561 |
+
if(vakata_context.is_visible) {
|
6562 |
+
vakata_context.element.hide().find("ul").hide().end().find(':focus').blur().end().detach();
|
6563 |
+
vakata_context.is_visible = false;
|
6564 |
+
/**
|
6565 |
+
* triggered on the document when the contextmenu is hidden
|
6566 |
+
* @event
|
6567 |
+
* @plugin contextmenu
|
6568 |
+
* @name context_hide.vakata
|
6569 |
+
* @param {jQuery} reference the element that was right clicked
|
6570 |
+
* @param {jQuery} element the DOM element of the menu itself
|
6571 |
+
* @param {Object} position the x & y coordinates of the menu
|
6572 |
+
*/
|
6573 |
+
$.vakata.context._trigger("hide");
|
6574 |
+
}
|
6575 |
+
}
|
6576 |
+
};
|
6577 |
+
$(function () {
|
6578 |
+
right_to_left = $(document.body).css("direction") === "rtl";
|
6579 |
+
var to = false;
|
6580 |
+
|
6581 |
+
vakata_context.element = $("<ul class='vakata-context'></ul>");
|
6582 |
+
vakata_context.element
|
6583 |
+
.on("mouseenter", "li", function (e) {
|
6584 |
+
e.stopImmediatePropagation();
|
6585 |
+
|
6586 |
+
if($.contains(this, e.relatedTarget)) {
|
6587 |
+
// премахнато заради delegate mouseleave по-долу
|
6588 |
+
// $(this).find(".vakata-context-hover").removeClass("vakata-context-hover");
|
6589 |
+
return;
|
6590 |
+
}
|
6591 |
+
|
6592 |
+
if(to) { clearTimeout(to); }
|
6593 |
+
vakata_context.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end();
|
6594 |
+
|
6595 |
+
$(this)
|
6596 |
+
.siblings().find("ul").hide().end().end()
|
6597 |
+
.parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover");
|
6598 |
+
$.vakata.context._show_submenu(this);
|
6599 |
+
})
|
6600 |
+
// тестово - дали не натоварва?
|
6601 |
+
.on("mouseleave", "li", function (e) {
|
6602 |
+
if($.contains(this, e.relatedTarget)) { return; }
|
6603 |
+
$(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover");
|
6604 |
+
})
|
6605 |
+
.on("mouseleave", function (e) {
|
6606 |
+
$(this).find(".vakata-context-hover").removeClass("vakata-context-hover");
|
6607 |
+
if($.vakata.context.settings.hide_onmouseleave) {
|
6608 |
+
to = setTimeout(
|
6609 |
+
(function (t) {
|
6610 |
+
return function () { $.vakata.context.hide(); };
|
6611 |
+
}(this)), $.vakata.context.settings.hide_onmouseleave);
|
6612 |
+
}
|
6613 |
+
})
|
6614 |
+
.on("click", "a", function (e) {
|
6615 |
+
e.preventDefault();
|
6616 |
+
//})
|
6617 |
+
//.on("mouseup", "a", function (e) {
|
6618 |
+
if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) {
|
6619 |
+
$.vakata.context.hide();
|
6620 |
+
}
|
6621 |
+
})
|
6622 |
+
.on('keydown', 'a', function (e) {
|
6623 |
+
var o = null;
|
6624 |
+
switch(e.which) {
|
6625 |
+
case 13:
|
6626 |
+
case 32:
|
6627 |
+
e.type = "click";
|
6628 |
+
e.preventDefault();
|
6629 |
+
$(e.currentTarget).trigger(e);
|
6630 |
+
break;
|
6631 |
+
case 37:
|
6632 |
+
if(vakata_context.is_visible) {
|
6633 |
+
vakata_context.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();
|
6634 |
+
e.stopImmediatePropagation();
|
6635 |
+
e.preventDefault();
|
6636 |
+
}
|
6637 |
+
break;
|
6638 |
+
case 38:
|
6639 |
+
if(vakata_context.is_visible) {
|
6640 |
+
o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first();
|
6641 |
+
if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last(); }
|
6642 |
+
o.addClass("vakata-context-hover").children('a').focus();
|
6643 |
+
e.stopImmediatePropagation();
|
6644 |
+
e.preventDefault();
|
6645 |
+
}
|
6646 |
+
break;
|
6647 |
+
case 39:
|
6648 |
+
if(vakata_context.is_visible) {
|
6649 |
+
vakata_context.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();
|
6650 |
+
e.stopImmediatePropagation();
|
6651 |
+
e.preventDefault();
|
6652 |
+
}
|
6653 |
+
break;
|
6654 |
+
case 40:
|
6655 |
+
if(vakata_context.is_visible) {
|
6656 |
+
o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first();
|
6657 |
+
if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first(); }
|
6658 |
+
o.addClass("vakata-context-hover").children('a').focus();
|
6659 |
+
e.stopImmediatePropagation();
|
6660 |
+
e.preventDefault();
|
6661 |
+
}
|
6662 |
+
break;
|
6663 |
+
case 27:
|
6664 |
+
$.vakata.context.hide();
|
6665 |
+
e.preventDefault();
|
6666 |
+
break;
|
6667 |
+
default:
|
6668 |
+
//console.log(e.which);
|
6669 |
+
break;
|
6670 |
+
}
|
6671 |
+
})
|
6672 |
+
.on('keydown', function (e) {
|
6673 |
+
e.preventDefault();
|
6674 |
+
var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent();
|
6675 |
+
if(a.parent().not('.vakata-context-disabled')) {
|
6676 |
+
a.click();
|
6677 |
+
}
|
6678 |
+
});
|
6679 |
+
|
6680 |
+
$(document)
|
6681 |
+
.on("mousedown.vakata.jstree", function (e) {
|
6682 |
+
if(vakata_context.is_visible && vakata_context.element[0] !== e.target && !$.contains(vakata_context.element[0], e.target)) {
|
6683 |
+
$.vakata.context.hide();
|
6684 |
+
}
|
6685 |
+
})
|
6686 |
+
.on("context_show.vakata.jstree", function (e, data) {
|
6687 |
+
vakata_context.element.find("li:has(ul)").children("a").addClass("vakata-context-parent");
|
6688 |
+
if(right_to_left) {
|
6689 |
+
vakata_context.element.addClass("vakata-context-rtl").css("direction", "rtl");
|
6690 |
+
}
|
6691 |
+
// also apply a RTL class?
|
6692 |
+
vakata_context.element.find("ul").hide().end();
|
6693 |
+
});
|
6694 |
+
});
|
6695 |
+
}($));
|
6696 |
+
// $.jstree.defaults.plugins.push("contextmenu");
|
6697 |
+
|
6698 |
+
|
6699 |
+
/**
|
6700 |
+
* ### Drag'n'drop plugin
|
6701 |
+
*
|
6702 |
+
* Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations.
|
6703 |
+
*/
|
6704 |
+
|
6705 |
+
/**
|
6706 |
+
* stores all defaults for the drag'n'drop plugin
|
6707 |
+
* @name $.jstree.defaults.dnd
|
6708 |
+
* @plugin dnd
|
6709 |
+
*/
|
6710 |
+
$.jstree.defaults.dnd = {
|
6711 |
+
/**
|
6712 |
+
* a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`.
|
6713 |
+
* @name $.jstree.defaults.dnd.copy
|
6714 |
+
* @plugin dnd
|
6715 |
+
*/
|
6716 |
+
copy : true,
|
6717 |
+
/**
|
6718 |
+
* a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`.
|
6719 |
+
* @name $.jstree.defaults.dnd.open_timeout
|
6720 |
+
* @plugin dnd
|
6721 |
+
*/
|
6722 |
+
open_timeout : 500,
|
6723 |
+
/**
|
6724 |
+
* a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) and the event that started the drag - return `false` to prevent dragging
|
6725 |
+
* @name $.jstree.defaults.dnd.is_draggable
|
6726 |
+
* @plugin dnd
|
6727 |
+
*/
|
6728 |
+
is_draggable : true,
|
6729 |
+
/**
|
6730 |
+
* a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true`
|
6731 |
+
* @name $.jstree.defaults.dnd.check_while_dragging
|
6732 |
+
* @plugin dnd
|
6733 |
+
*/
|
6734 |
+
check_while_dragging : true,
|
6735 |
+
/**
|
6736 |
+
* a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false`
|
6737 |
+
* @name $.jstree.defaults.dnd.always_copy
|
6738 |
+
* @plugin dnd
|
6739 |
+
*/
|
6740 |
+
always_copy : false,
|
6741 |
+
/**
|
6742 |
+
* when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0`
|
6743 |
+
* @name $.jstree.defaults.dnd.inside_pos
|
6744 |
+
* @plugin dnd
|
6745 |
+
*/
|
6746 |
+
inside_pos : 0,
|
6747 |
+
/**
|
6748 |
+
* when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node
|
6749 |
+
* @name $.jstree.defaults.dnd.drag_selection
|
6750 |
+
* @plugin dnd
|
6751 |
+
*/
|
6752 |
+
drag_selection : true,
|
6753 |
+
/**
|
6754 |
+
* controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices.
|
6755 |
+
* @name $.jstree.defaults.dnd.touch
|
6756 |
+
* @plugin dnd
|
6757 |
+
*/
|
6758 |
+
touch : true,
|
6759 |
+
/**
|
6760 |
+
* controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target.
|
6761 |
+
* @name $.jstree.defaults.dnd.large_drop_target
|
6762 |
+
* @plugin dnd
|
6763 |
+
*/
|
6764 |
+
large_drop_target : false,
|
6765 |
+
/**
|
6766 |
+
* controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected".
|
6767 |
+
* @name $.jstree.defaults.dnd.large_drag_target
|
6768 |
+
* @plugin dnd
|
6769 |
+
*/
|
6770 |
+
large_drag_target : false,
|
6771 |
+
/**
|
6772 |
+
* controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls.
|
6773 |
+
* @reference http://caniuse.com/#feat=dragndrop
|
6774 |
+
* @name $.jstree.defaults.dnd.use_html5
|
6775 |
+
* @plugin dnd
|
6776 |
+
*/
|
6777 |
+
use_html5: false
|
6778 |
+
};
|
6779 |
+
var drg, elm;
|
6780 |
+
// TODO: now check works by checking for each node individually, how about max_children, unique, etc?
|
6781 |
+
$.jstree.plugins.dnd = function (options, parent) {
|
6782 |
+
this.init = function (el, options) {
|
6783 |
+
parent.init.call(this, el, options);
|
6784 |
+
this.settings.dnd.use_html5 = this.settings.dnd.use_html5 && ('draggable' in document.createElement('span'));
|
6785 |
+
};
|
6786 |
+
this.bind = function () {
|
6787 |
+
parent.bind.call(this);
|
6788 |
+
|
6789 |
+
this.element
|
6790 |
+
.on(this.settings.dnd.use_html5 ? 'dragstart.jstree' : 'mousedown.jstree touchstart.jstree', this.settings.dnd.large_drag_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) {
|
6791 |
+
if(this.settings.dnd.large_drag_target && $(e.target).closest('.jstree-node')[0] !== e.currentTarget) {
|
6792 |
+
return true;
|
6793 |
+
}
|
6794 |
+
if(e.type === "touchstart" && (!this.settings.dnd.touch || (this.settings.dnd.touch === 'selected' && !$(e.currentTarget).closest('.jstree-node').children('.jstree-anchor').hasClass('jstree-clicked')))) {
|
6795 |
+
return true;
|
6796 |
+
}
|
6797 |
+
var obj = this.get_node(e.target),
|
6798 |
+
mlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1,
|
6799 |
+
txt = (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget));
|
6800 |
+
if(this.settings.core.force_text) {
|
6801 |
+
txt = $.vakata.html.escape(txt);
|
6802 |
+
}
|
6803 |
+
if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") &&
|
6804 |
+
(this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e)))
|
6805 |
+
) {
|
6806 |
+
drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] };
|
6807 |
+
elm = e.currentTarget;
|
6808 |
+
if (this.settings.dnd.use_html5) {
|
6809 |
+
$.vakata.dnd._trigger('start', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6810 |
+
} else {
|
6811 |
+
this.element.trigger('mousedown.jstree');
|
6812 |
+
return $.vakata.dnd.start(e, drg, '<div id="jstree-dnd" data-txt="'+txt+'" class="jstree-' + this.get_theme() + ' jstree-' + this.get_theme() + '-' + this.get_theme_variant() + ' ' + ( this.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' ) + '">'+txt+'</div>');
|
6813 |
+
}
|
6814 |
+
}
|
6815 |
+
}, this));
|
6816 |
+
if (this.settings.dnd.use_html5) {
|
6817 |
+
this.element
|
6818 |
+
.on('dragover.jstree', function (e) {
|
6819 |
+
e.preventDefault();
|
6820 |
+
$.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6821 |
+
return false;
|
6822 |
+
})
|
6823 |
+
//.on('dragenter.jstree', this.settings.dnd.large_drop_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) {
|
6824 |
+
// e.preventDefault();
|
6825 |
+
// $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6826 |
+
// return false;
|
6827 |
+
// }, this))
|
6828 |
+
.on('drop.jstree', $.proxy(function (e) {
|
6829 |
+
e.preventDefault();
|
6830 |
+
$.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6831 |
+
return false;
|
6832 |
+
}, this));
|
6833 |
+
}
|
6834 |
+
};
|
6835 |
+
this.redraw_node = function(obj, deep, callback, force_render) {
|
6836 |
+
obj = parent.redraw_node.apply(this, arguments);
|
6837 |
+
if (obj && this.settings.dnd.use_html5) {
|
6838 |
+
if (this.settings.dnd.large_drag_target) {
|
6839 |
+
obj.setAttribute('draggable', true);
|
6840 |
+
} else {
|
6841 |
+
var i, j, tmp = null;
|
6842 |
+
for(i = 0, j = obj.childNodes.length; i < j; i++) {
|
6843 |
+
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
|
6844 |
+
tmp = obj.childNodes[i];
|
6845 |
+
break;
|
6846 |
+
}
|
6847 |
+
}
|
6848 |
+
if(tmp) {
|
6849 |
+
tmp.setAttribute('draggable', true);
|
6850 |
+
}
|
6851 |
+
}
|
6852 |
+
}
|
6853 |
+
return obj;
|
6854 |
+
};
|
6855 |
+
};
|
6856 |
+
|
6857 |
+
$(function() {
|
6858 |
+
// bind only once for all instances
|
6859 |
+
var lastmv = false,
|
6860 |
+
laster = false,
|
6861 |
+
lastev = false,
|
6862 |
+
opento = false,
|
6863 |
+
marker = $('<div id="jstree-marker"> </div>').hide(); //.appendTo('body');
|
6864 |
+
|
6865 |
+
$(document)
|
6866 |
+
.on('dragover.vakata.jstree', function (e) {
|
6867 |
+
if (elm) {
|
6868 |
+
$.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6869 |
+
}
|
6870 |
+
})
|
6871 |
+
.on('drop.vakata.jstree', function (e) {
|
6872 |
+
if (elm) {
|
6873 |
+
$.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg });
|
6874 |
+
elm = null;
|
6875 |
+
drg = null;
|
6876 |
+
}
|
6877 |
+
})
|
6878 |
+
.on('dnd_start.vakata.jstree', function (e, data) {
|
6879 |
+
lastmv = false;
|
6880 |
+
lastev = false;
|
6881 |
+
if(!data || !data.data || !data.data.jstree) { return; }
|
6882 |
+
marker.appendTo(document.body); //.show();
|
6883 |
+
})
|
6884 |
+
.on('dnd_move.vakata.jstree', function (e, data) {
|
6885 |
+
var isDifferentNode = data.event.target !== lastev.target;
|
6886 |
+
if(opento) {
|
6887 |
+
if (!data.event || data.event.type !== 'dragover' || isDifferentNode) {
|
6888 |
+
clearTimeout(opento);
|
6889 |
+
}
|
6890 |
+
}
|
6891 |
+
if(!data || !data.data || !data.data.jstree) { return; }
|
6892 |
+
|
6893 |
+
// if we are hovering the marker image do nothing (can happen on "inside" drags)
|
6894 |
+
if(data.event.target.id && data.event.target.id === 'jstree-marker') {
|
6895 |
+
return;
|
6896 |
+
}
|
6897 |
+
lastev = data.event;
|
6898 |
+
|
6899 |
+
var ins = $.jstree.reference(data.event.target),
|
6900 |
+
ref = false,
|
6901 |
+
off = false,
|
6902 |
+
rel = false,
|
6903 |
+
tmp, l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm, is_copy, pn, c;
|
6904 |
+
// if we are over an instance
|
6905 |
+
if(ins && ins._data && ins._data.dnd) {
|
6906 |
+
marker.attr('class', 'jstree-' + ins.get_theme() + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' ));
|
6907 |
+
is_copy = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)));
|
6908 |
+
data.helper
|
6909 |
+
.children().attr('class', 'jstree-' + ins.get_theme() + ' jstree-' + ins.get_theme() + '-' + ins.get_theme_variant() + ' ' + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' ))
|
6910 |
+
.find('.jstree-copy').first()[ is_copy ? 'show' : 'hide' ]();
|
6911 |
+
|
6912 |
+
// if are hovering the container itself add a new root node
|
6913 |
+
//console.log(data.event);
|
6914 |
+
if( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && ins.get_container_ul().children().length === 0) {
|
6915 |
+
ok = true;
|
6916 |
+
for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {
|
6917 |
+
ok = ok && ins.check( (data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)) ) ? "copy_node" : "move_node"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), $.jstree.root, 'last', { 'dnd' : true, 'ref' : ins.get_node($.jstree.root), 'pos' : 'i', 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) });
|
6918 |
+
if(!ok) { break; }
|
6919 |
+
}
|
6920 |
+
if(ok) {
|
6921 |
+
lastmv = { 'ins' : ins, 'par' : $.jstree.root, 'pos' : 'last' };
|
6922 |
+
marker.hide();
|
6923 |
+
data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok');
|
6924 |
+
if (data.event.originalEvent && data.event.originalEvent.dataTransfer) {
|
6925 |
+
data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move';
|
6926 |
+
}
|
6927 |
+
return;
|
6928 |
+
}
|
6929 |
+
}
|
6930 |
+
else {
|
6931 |
+
// if we are hovering a tree node
|
6932 |
+
ref = ins.settings.dnd.large_drop_target ? $(data.event.target).closest('.jstree-node').children('.jstree-anchor') : $(data.event.target).closest('.jstree-anchor');
|
6933 |
+
if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) {
|
6934 |
+
off = ref.offset();
|
6935 |
+
rel = (data.event.pageY !== undefined ? data.event.pageY : data.event.originalEvent.pageY) - off.top;
|
6936 |
+
h = ref.outerHeight();
|
6937 |
+
if(rel < h / 3) {
|
6938 |
+
o = ['b', 'i', 'a'];
|
6939 |
+
}
|
6940 |
+
else if(rel > h - h / 3) {
|
6941 |
+
o = ['a', 'i', 'b'];
|
6942 |
+
}
|
6943 |
+
else {
|
6944 |
+
o = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a'];
|
6945 |
+
}
|
6946 |
+
$.each(o, function (j, v) {
|
6947 |
+
switch(v) {
|
6948 |
+
case 'b':
|
6949 |
+
l = off.left - 6;
|
6950 |
+
t = off.top;
|
6951 |
+
p = ins.get_parent(ref);
|
6952 |
+
i = ref.parent().index();
|
6953 |
+
c = 'jstree-below';
|
6954 |
+
break;
|
6955 |
+
case 'i':
|
6956 |
+
ip = ins.settings.dnd.inside_pos;
|
6957 |
+
tm = ins.get_node(ref.parent());
|
6958 |
+
l = off.left - 2;
|
6959 |
+
t = off.top + h / 2 + 1;
|
6960 |
+
p = tm.id;
|
6961 |
+
i = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length));
|
6962 |
+
c = 'jstree-inside';
|
6963 |
+
break;
|
6964 |
+
case 'a':
|
6965 |
+
l = off.left - 6;
|
6966 |
+
t = off.top + h;
|
6967 |
+
p = ins.get_parent(ref);
|
6968 |
+
i = ref.parent().index() + 1;
|
6969 |
+
c = 'jstree-above';
|
6970 |
+
break;
|
6971 |
+
}
|
6972 |
+
ok = true;
|
6973 |
+
for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {
|
6974 |
+
op = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? "copy_node" : "move_node";
|
6975 |
+
ps = i;
|
6976 |
+
if(op === "move_node" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) {
|
6977 |
+
pr = ins.get_node(p);
|
6978 |
+
if(ps > $.inArray(data.data.nodes[t1], pr.children)) {
|
6979 |
+
ps -= 1;
|
6980 |
+
}
|
6981 |
+
}
|
6982 |
+
ok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps, { 'dnd' : true, 'ref' : ins.get_node(ref.parent()), 'pos' : v, 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) );
|
6983 |
+
if(!ok) {
|
6984 |
+
if(ins && ins.last_error) { laster = ins.last_error(); }
|
6985 |
+
break;
|
6986 |
+
}
|
6987 |
+
}
|
6988 |
+
if(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) {
|
6989 |
+
if (!data.event || data.event.type !== 'dragover' || isDifferentNode) {
|
6990 |
+
if (opento) { clearTimeout(opento); }
|
6991 |
+
opento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout);
|
6992 |
+
}
|
6993 |
+
}
|
6994 |
+
if(ok) {
|
6995 |
+
pn = ins.get_node(p, true);
|
6996 |
+
if (!pn.hasClass('.jstree-dnd-parent')) {
|
6997 |
+
$('.jstree-dnd-parent').removeClass('jstree-dnd-parent');
|
6998 |
+
pn.addClass('jstree-dnd-parent');
|
6999 |
+
}
|
7000 |
+
lastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i };
|
7001 |
+
marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show();
|
7002 |
+
marker.removeClass('jstree-above jstree-inside jstree-below').addClass(c);
|
7003 |
+
data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok');
|
7004 |
+
if (data.event.originalEvent && data.event.originalEvent.dataTransfer) {
|
7005 |
+
data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move';
|
7006 |
+
}
|
7007 |
+
laster = {};
|
7008 |
+
o = true;
|
7009 |
+
return false;
|
7010 |
+
}
|
7011 |
+
});
|
7012 |
+
if(o === true) { return; }
|
7013 |
+
}
|
7014 |
+
}
|
7015 |
+
}
|
7016 |
+
$('.jstree-dnd-parent').removeClass('jstree-dnd-parent');
|
7017 |
+
lastmv = false;
|
7018 |
+
data.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er');
|
7019 |
+
if (data.event.originalEvent && data.event.originalEvent.dataTransfer) {
|
7020 |
+
//data.event.originalEvent.dataTransfer.dropEffect = 'none';
|
7021 |
+
}
|
7022 |
+
marker.hide();
|
7023 |
+
})
|
7024 |
+
.on('dnd_scroll.vakata.jstree', function (e, data) {
|
7025 |
+
if(!data || !data.data || !data.data.jstree) { return; }
|
7026 |
+
marker.hide();
|
7027 |
+
lastmv = false;
|
7028 |
+
lastev = false;
|
7029 |
+
data.helper.find('.jstree-icon').first().removeClass('jstree-ok').addClass('jstree-er');
|
7030 |
+
})
|
7031 |
+
.on('dnd_stop.vakata.jstree', function (e, data) {
|
7032 |
+
$('.jstree-dnd-parent').removeClass('jstree-dnd-parent');
|
7033 |
+
if(opento) { clearTimeout(opento); }
|
7034 |
+
if(!data || !data.data || !data.data.jstree) { return; }
|
7035 |
+
marker.hide().detach();
|
7036 |
+
var i, j, nodes = [];
|
7037 |
+
if(lastmv) {
|
7038 |
+
for(i = 0, j = data.data.nodes.length; i < j; i++) {
|
7039 |
+
nodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i];
|
7040 |
+
}
|
7041 |
+
lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos, false, false, false, data.data.origin);
|
7042 |
+
}
|
7043 |
+
else {
|
7044 |
+
i = $(data.event.target).closest('.jstree');
|
7045 |
+
if(i.length && laster && laster.error && laster.error === 'check') {
|
7046 |
+
i = i.jstree(true);
|
7047 |
+
if(i) {
|
7048 |
+
i.settings.core.error.call(this, laster);
|
7049 |
+
}
|
7050 |
+
}
|
7051 |
+
}
|
7052 |
+
lastev = false;
|
7053 |
+
lastmv = false;
|
7054 |
+
})
|
7055 |
+
.on('keyup.jstree keydown.jstree', function (e, data) {
|
7056 |
+
data = $.vakata.dnd._get();
|
7057 |
+
if(data && data.data && data.data.jstree) {
|
7058 |
+
if (e.type === "keyup" && e.which === 27) {
|
7059 |
+
if (opento) { clearTimeout(opento); }
|
7060 |
+
lastmv = false;
|
7061 |
+
laster = false;
|
7062 |
+
lastev = false;
|
7063 |
+
opento = false;
|
7064 |
+
marker.hide().detach();
|
7065 |
+
$.vakata.dnd._clean();
|
7066 |
+
} else {
|
7067 |
+
data.helper.find('.jstree-copy').first()[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ]();
|
7068 |
+
if(lastev) {
|
7069 |
+
lastev.metaKey = e.metaKey;
|
7070 |
+
lastev.ctrlKey = e.ctrlKey;
|
7071 |
+
$.vakata.dnd._trigger('move', lastev);
|
7072 |
+
}
|
7073 |
+
}
|
7074 |
+
}
|
7075 |
+
});
|
7076 |
+
});
|
7077 |
+
|
7078 |
+
// helpers
|
7079 |
+
(function ($) {
|
7080 |
+
$.vakata.html = {
|
7081 |
+
div : $('<div></div>'),
|
7082 |
+
escape : function (str) {
|
7083 |
+
return $.vakata.html.div.text(str).html();
|
7084 |
+
},
|
7085 |
+
strip : function (str) {
|
7086 |
+
return $.vakata.html.div.empty().append($.parseHTML(str)).text();
|
7087 |
+
}
|
7088 |
+
};
|
7089 |
+
// private variable
|
7090 |
+
var vakata_dnd = {
|
7091 |
+
element : false,
|
7092 |
+
target : false,
|
7093 |
+
is_down : false,
|
7094 |
+
is_drag : false,
|
7095 |
+
helper : false,
|
7096 |
+
helper_w: 0,
|
7097 |
+
data : false,
|
7098 |
+
init_x : 0,
|
7099 |
+
init_y : 0,
|
7100 |
+
scroll_l: 0,
|
7101 |
+
scroll_t: 0,
|
7102 |
+
scroll_e: false,
|
7103 |
+
scroll_i: false,
|
7104 |
+
is_touch: false
|
7105 |
+
};
|
7106 |
+
$.vakata.dnd = {
|
7107 |
+
settings : {
|
7108 |
+
scroll_speed : 10,
|
7109 |
+
scroll_proximity : 20,
|
7110 |
+
helper_left : 5,
|
7111 |
+
helper_top : 10,
|
7112 |
+
threshold : 5,
|
7113 |
+
threshold_touch : 10
|
7114 |
+
},
|
7115 |
+
_trigger : function (event_name, e, data) {
|
7116 |
+
if (data === undefined) {
|
7117 |
+
data = $.vakata.dnd._get();
|
7118 |
+
}
|
7119 |
+
data.event = e;
|
7120 |
+
$(document).triggerHandler("dnd_" + event_name + ".vakata", data);
|
7121 |
+
},
|
7122 |
+
_get : function () {
|
7123 |
+
return {
|
7124 |
+
"data" : vakata_dnd.data,
|
7125 |
+
"element" : vakata_dnd.element,
|
7126 |
+
"helper" : vakata_dnd.helper
|
7127 |
+
};
|
7128 |
+
},
|
7129 |
+
_clean : function () {
|
7130 |
+
if(vakata_dnd.helper) { vakata_dnd.helper.remove(); }
|
7131 |
+
if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }
|
7132 |
+
vakata_dnd = {
|
7133 |
+
element : false,
|
7134 |
+
target : false,
|
7135 |
+
is_down : false,
|
7136 |
+
is_drag : false,
|
7137 |
+
helper : false,
|
7138 |
+
helper_w: 0,
|
7139 |
+
data : false,
|
7140 |
+
init_x : 0,
|
7141 |
+
init_y : 0,
|
7142 |
+
scroll_l: 0,
|
7143 |
+
scroll_t: 0,
|
7144 |
+
scroll_e: false,
|
7145 |
+
scroll_i: false,
|
7146 |
+
is_touch: false
|
7147 |
+
};
|
7148 |
+
elm = null;
|
7149 |
+
$(document).off("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag);
|
7150 |
+
$(document).off("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop);
|
7151 |
+
},
|
7152 |
+
_scroll : function (init_only) {
|
7153 |
+
if(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) {
|
7154 |
+
if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }
|
7155 |
+
return false;
|
7156 |
+
}
|
7157 |
+
if(!vakata_dnd.scroll_i) {
|
7158 |
+
vakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100);
|
7159 |
+
return false;
|
7160 |
+
}
|
7161 |
+
if(init_only === true) { return false; }
|
7162 |
+
|
7163 |
+
var i = vakata_dnd.scroll_e.scrollTop(),
|
7164 |
+
j = vakata_dnd.scroll_e.scrollLeft();
|
7165 |
+
vakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed);
|
7166 |
+
vakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed);
|
7167 |
+
if(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) {
|
7168 |
+
/**
|
7169 |
+
* triggered on the document when a drag causes an element to scroll
|
7170 |
+
* @event
|
7171 |
+
* @plugin dnd
|
7172 |
+
* @name dnd_scroll.vakata
|
7173 |
+
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
|
7174 |
+
* @param {DOM} element the DOM element being dragged
|
7175 |
+
* @param {jQuery} helper the helper shown next to the mouse
|
7176 |
+
* @param {jQuery} event the element that is scrolling
|
7177 |
+
*/
|
7178 |
+
$.vakata.dnd._trigger("scroll", vakata_dnd.scroll_e);
|
7179 |
+
}
|
7180 |
+
},
|
7181 |
+
start : function (e, data, html) {
|
7182 |
+
if(e.type === "touchstart" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {
|
7183 |
+
e.pageX = e.originalEvent.changedTouches[0].pageX;
|
7184 |
+
e.pageY = e.originalEvent.changedTouches[0].pageY;
|
7185 |
+
e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);
|
7186 |
+
}
|
7187 |
+
if(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); }
|
7188 |
+
try {
|
7189 |
+
e.currentTarget.unselectable = "on";
|
7190 |
+
e.currentTarget.onselectstart = function() { return false; };
|
7191 |
+
if(e.currentTarget.style) {
|
7192 |
+
e.currentTarget.style.touchAction = "none";
|
7193 |
+
e.currentTarget.style.msTouchAction = "none";
|
7194 |
+
e.currentTarget.style.MozUserSelect = "none";
|
7195 |
+
}
|
7196 |
+
} catch(ignore) { }
|
7197 |
+
vakata_dnd.init_x = e.pageX;
|
7198 |
+
vakata_dnd.init_y = e.pageY;
|
7199 |
+
vakata_dnd.data = data;
|
7200 |
+
vakata_dnd.is_down = true;
|
7201 |
+
vakata_dnd.element = e.currentTarget;
|
7202 |
+
vakata_dnd.target = e.target;
|
7203 |
+
vakata_dnd.is_touch = e.type === "touchstart";
|
7204 |
+
if(html !== false) {
|
7205 |
+
vakata_dnd.helper = $("<div id='vakata-dnd'></div>").html(html).css({
|
7206 |
+
"display" : "block",
|
7207 |
+
"margin" : "0",
|
7208 |
+
"padding" : "0",
|
7209 |
+
"position" : "absolute",
|
7210 |
+
"top" : "-2000px",
|
7211 |
+
"lineHeight" : "16px",
|
7212 |
+
"zIndex" : "10000"
|
7213 |
+
});
|
7214 |
+
}
|
7215 |
+
$(document).on("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag);
|
7216 |
+
$(document).on("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop);
|
7217 |
+
return false;
|
7218 |
+
},
|
7219 |
+
drag : function (e) {
|
7220 |
+
if(e.type === "touchmove" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {
|
7221 |
+
e.pageX = e.originalEvent.changedTouches[0].pageX;
|
7222 |
+
e.pageY = e.originalEvent.changedTouches[0].pageY;
|
7223 |
+
e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);
|
7224 |
+
}
|
7225 |
+
if(!vakata_dnd.is_down) { return; }
|
7226 |
+
if(!vakata_dnd.is_drag) {
|
7227 |
+
if(
|
7228 |
+
Math.abs(e.pageX - vakata_dnd.init_x) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) ||
|
7229 |
+
Math.abs(e.pageY - vakata_dnd.init_y) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold)
|
7230 |
+
) {
|
7231 |
+
if(vakata_dnd.helper) {
|
7232 |
+
vakata_dnd.helper.appendTo(document.body);
|
7233 |
+
vakata_dnd.helper_w = vakata_dnd.helper.outerWidth();
|
7234 |
+
}
|
7235 |
+
vakata_dnd.is_drag = true;
|
7236 |
+
$(vakata_dnd.target).one('click.vakata', false);
|
7237 |
+
/**
|
7238 |
+
* triggered on the document when a drag starts
|
7239 |
+
* @event
|
7240 |
+
* @plugin dnd
|
7241 |
+
* @name dnd_start.vakata
|
7242 |
+
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
|
7243 |
+
* @param {DOM} element the DOM element being dragged
|
7244 |
+
* @param {jQuery} helper the helper shown next to the mouse
|
7245 |
+
* @param {Object} event the event that caused the start (probably mousemove)
|
7246 |
+
*/
|
7247 |
+
$.vakata.dnd._trigger("start", e);
|
7248 |
+
}
|
7249 |
+
else { return; }
|
7250 |
+
}
|
7251 |
+
|
7252 |
+
var d = false, w = false,
|
7253 |
+
dh = false, wh = false,
|
7254 |
+
dw = false, ww = false,
|
7255 |
+
dt = false, dl = false,
|
7256 |
+
ht = false, hl = false;
|
7257 |
+
|
7258 |
+
vakata_dnd.scroll_t = 0;
|
7259 |
+
vakata_dnd.scroll_l = 0;
|
7260 |
+
vakata_dnd.scroll_e = false;
|
7261 |
+
$($(e.target).parentsUntil("body").addBack().get().reverse())
|
7262 |
+
.filter(function () {
|
7263 |
+
return (/^auto|scroll$/).test($(this).css("overflow")) &&
|
7264 |
+
(this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth);
|
7265 |
+
})
|
7266 |
+
.each(function () {
|
7267 |
+
var t = $(this), o = t.offset();
|
7268 |
+
if(this.scrollHeight > this.offsetHeight) {
|
7269 |
+
if(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; }
|
7270 |
+
if(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; }
|
7271 |
+
}
|
7272 |
+
if(this.scrollWidth > this.offsetWidth) {
|
7273 |
+
if(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; }
|
7274 |
+
if(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; }
|
7275 |
+
}
|
7276 |
+
if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {
|
7277 |
+
vakata_dnd.scroll_e = $(this);
|
7278 |
+
return false;
|
7279 |
+
}
|
7280 |
+
});
|
7281 |
+
|
7282 |
+
if(!vakata_dnd.scroll_e) {
|
7283 |
+
d = $(document); w = $(window);
|
7284 |
+
dh = d.height(); wh = w.height();
|
7285 |
+
dw = d.width(); ww = w.width();
|
7286 |
+
dt = d.scrollTop(); dl = d.scrollLeft();
|
7287 |
+
if(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; }
|
7288 |
+
if(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; }
|
7289 |
+
if(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; }
|
7290 |
+
if(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; }
|
7291 |
+
if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {
|
7292 |
+
vakata_dnd.scroll_e = d;
|
7293 |
+
}
|
7294 |
+
}
|
7295 |
+
if(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); }
|
7296 |
+
|
7297 |
+
if(vakata_dnd.helper) {
|
7298 |
+
ht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10);
|
7299 |
+
hl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10);
|
7300 |
+
if(dh && ht + 25 > dh) { ht = dh - 50; }
|
7301 |
+
if(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); }
|
7302 |
+
vakata_dnd.helper.css({
|
7303 |
+
left : hl + "px",
|
7304 |
+
top : ht + "px"
|
7305 |
+
});
|
7306 |
+
}
|
7307 |
+
/**
|
7308 |
+
* triggered on the document when a drag is in progress
|
7309 |
+
* @event
|
7310 |
+
* @plugin dnd
|
7311 |
+
* @name dnd_move.vakata
|
7312 |
+
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
|
7313 |
+
* @param {DOM} element the DOM element being dragged
|
7314 |
+
* @param {jQuery} helper the helper shown next to the mouse
|
7315 |
+
* @param {Object} event the event that caused this to trigger (most likely mousemove)
|
7316 |
+
*/
|
7317 |
+
$.vakata.dnd._trigger("move", e);
|
7318 |
+
return false;
|
7319 |
+
},
|
7320 |
+
stop : function (e) {
|
7321 |
+
if(e.type === "touchend" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) {
|
7322 |
+
e.pageX = e.originalEvent.changedTouches[0].pageX;
|
7323 |
+
e.pageY = e.originalEvent.changedTouches[0].pageY;
|
7324 |
+
e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset);
|
7325 |
+
}
|
7326 |
+
if(vakata_dnd.is_drag) {
|
7327 |
+
/**
|
7328 |
+
* triggered on the document when a drag stops (the dragged element is dropped)
|
7329 |
+
* @event
|
7330 |
+
* @plugin dnd
|
7331 |
+
* @name dnd_stop.vakata
|
7332 |
+
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
|
7333 |
+
* @param {DOM} element the DOM element being dragged
|
7334 |
+
* @param {jQuery} helper the helper shown next to the mouse
|
7335 |
+
* @param {Object} event the event that caused the stop
|
7336 |
+
*/
|
7337 |
+
if (e.target !== vakata_dnd.target) {
|
7338 |
+
$(vakata_dnd.target).off('click.vakata');
|
7339 |
+
}
|
7340 |
+
$.vakata.dnd._trigger("stop", e);
|
7341 |
+
}
|
7342 |
+
else {
|
7343 |
+
if(e.type === "touchend" && e.target === vakata_dnd.target) {
|
7344 |
+
var to = setTimeout(function () { $(e.target).click(); }, 100);
|
7345 |
+
$(e.target).one('click', function() { if(to) { clearTimeout(to); } });
|
7346 |
+
}
|
7347 |
+
}
|
7348 |
+
$.vakata.dnd._clean();
|
7349 |
+
return false;
|
7350 |
+
}
|
7351 |
+
};
|
7352 |
+
}($));
|
7353 |
+
|
7354 |
+
// include the dnd plugin by default
|
7355 |
+
// $.jstree.defaults.plugins.push("dnd");
|
7356 |
+
|
7357 |
+
|
7358 |
+
/**
|
7359 |
+
* ### Massload plugin
|
7360 |
+
*
|
7361 |
+
* Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading).
|
7362 |
+
*/
|
7363 |
+
|
7364 |
+
/**
|
7365 |
+
* massload configuration
|
7366 |
+
*
|
7367 |
+
* It is possible to set this to a standard jQuery-like AJAX config.
|
7368 |
+
* In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used.
|
7369 |
+
*
|
7370 |
+
* You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result.
|
7371 |
+
*
|
7372 |
+
* Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array.
|
7373 |
+
*
|
7374 |
+
* {
|
7375 |
+
* "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }],
|
7376 |
+
* "id2" : [{ "text" : "Child of ID2", "id" : "c3" }]
|
7377 |
+
* }
|
7378 |
+
*
|
7379 |
+
* @name $.jstree.defaults.massload
|
7380 |
+
* @plugin massload
|
7381 |
+
*/
|
7382 |
+
$.jstree.defaults.massload = null;
|
7383 |
+
$.jstree.plugins.massload = function (options, parent) {
|
7384 |
+
this.init = function (el, options) {
|
7385 |
+
this._data.massload = {};
|
7386 |
+
parent.init.call(this, el, options);
|
7387 |
+
};
|
7388 |
+
this._load_nodes = function (nodes, callback, is_callback, force_reload) {
|
7389 |
+
var s = this.settings.massload,
|
7390 |
+
toLoad = [],
|
7391 |
+
m = this._model.data,
|
7392 |
+
i, j, dom;
|
7393 |
+
if (!is_callback) {
|
7394 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
7395 |
+
if(!m[nodes[i]] || ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || force_reload) ) {
|
7396 |
+
toLoad.push(nodes[i]);
|
7397 |
+
dom = this.get_node(nodes[i], true);
|
7398 |
+
if (dom && dom.length) {
|
7399 |
+
dom.addClass("jstree-loading").attr('aria-busy',true);
|
7400 |
+
}
|
7401 |
+
}
|
7402 |
+
}
|
7403 |
+
this._data.massload = {};
|
7404 |
+
if (toLoad.length) {
|
7405 |
+
if($.isFunction(s)) {
|
7406 |
+
return s.call(this, toLoad, $.proxy(function (data) {
|
7407 |
+
var i, j;
|
7408 |
+
if(data) {
|
7409 |
+
for(i in data) {
|
7410 |
+
if(data.hasOwnProperty(i)) {
|
7411 |
+
this._data.massload[i] = data[i];
|
7412 |
+
}
|
7413 |
+
}
|
7414 |
+
}
|
7415 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
7416 |
+
dom = this.get_node(nodes[i], true);
|
7417 |
+
if (dom && dom.length) {
|
7418 |
+
dom.removeClass("jstree-loading").attr('aria-busy',false);
|
7419 |
+
}
|
7420 |
+
}
|
7421 |
+
parent._load_nodes.call(this, nodes, callback, is_callback, force_reload);
|
7422 |
+
}, this));
|
7423 |
+
}
|
7424 |
+
if(typeof s === 'object' && s && s.url) {
|
7425 |
+
s = $.extend(true, {}, s);
|
7426 |
+
if($.isFunction(s.url)) {
|
7427 |
+
s.url = s.url.call(this, toLoad);
|
7428 |
+
}
|
7429 |
+
if($.isFunction(s.data)) {
|
7430 |
+
s.data = s.data.call(this, toLoad);
|
7431 |
+
}
|
7432 |
+
return $.ajax(s)
|
7433 |
+
.done($.proxy(function (data,t,x) {
|
7434 |
+
var i, j;
|
7435 |
+
if(data) {
|
7436 |
+
for(i in data) {
|
7437 |
+
if(data.hasOwnProperty(i)) {
|
7438 |
+
this._data.massload[i] = data[i];
|
7439 |
+
}
|
7440 |
+
}
|
7441 |
+
}
|
7442 |
+
for(i = 0, j = nodes.length; i < j; i++) {
|
7443 |
+
dom = this.get_node(nodes[i], true);
|
7444 |
+
if (dom && dom.length) {
|
7445 |
+
dom.removeClass("jstree-loading").attr('aria-busy',false);
|
7446 |
+
}
|
7447 |
+
}
|
7448 |
+
parent._load_nodes.call(this, nodes, callback, is_callback, force_reload);
|
7449 |
+
}, this))
|
7450 |
+
.fail($.proxy(function (f) {
|
7451 |
+
parent._load_nodes.call(this, nodes, callback, is_callback, force_reload);
|
7452 |
+
}, this));
|
7453 |
+
}
|
7454 |
+
}
|
7455 |
+
}
|
7456 |
+
return parent._load_nodes.call(this, nodes, callback, is_callback, force_reload);
|
7457 |
+
};
|
7458 |
+
this._load_node = function (obj, callback) {
|
7459 |
+
var data = this._data.massload[obj.id],
|
7460 |
+
rslt = null, dom;
|
7461 |
+
if(data) {
|
7462 |
+
rslt = this[typeof data === 'string' ? '_append_html_data' : '_append_json_data'](
|
7463 |
+
obj,
|
7464 |
+
typeof data === 'string' ? $($.parseHTML(data)).filter(function () { return this.nodeType !== 3; }) : data,
|
7465 |
+
function (status) { callback.call(this, status); }
|
7466 |
+
);
|
7467 |
+
dom = this.get_node(obj.id, true);
|
7468 |
+
if (dom && dom.length) {
|
7469 |
+
dom.removeClass("jstree-loading").attr('aria-busy',false);
|
7470 |
+
}
|
7471 |
+
delete this._data.massload[obj.id];
|
7472 |
+
return rslt;
|
7473 |
+
}
|
7474 |
+
return parent._load_node.call(this, obj, callback);
|
7475 |
+
};
|
7476 |
+
};
|
7477 |
+
|
7478 |
+
|
7479 |
+
/**
|
7480 |
+
* ### Search plugin
|
7481 |
+
*
|
7482 |
+
* Adds search functionality to jsTree.
|
7483 |
+
*/
|
7484 |
+
|
7485 |
+
/**
|
7486 |
+
* stores all defaults for the search plugin
|
7487 |
+
* @name $.jstree.defaults.search
|
7488 |
+
* @plugin search
|
7489 |
+
*/
|
7490 |
+
$.jstree.defaults.search = {
|
7491 |
+
/**
|
7492 |
+
* a jQuery-like AJAX config, which jstree uses if a server should be queried for results.
|
7493 |
+
*
|
7494 |
+
* A `str` (which is the search string) parameter will be added with the request, an optional `inside` parameter will be added if the search is limited to a node id. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed.
|
7495 |
+
* Leave this setting as `false` to not query the server. You can also set this to a function, which will be invoked in the instance's scope and receive 3 parameters - the search string, the callback to call with the array of nodes to load, and the optional node ID to limit the search to
|
7496 |
+
* @name $.jstree.defaults.search.ajax
|
7497 |
+
* @plugin search
|
7498 |
+
*/
|
7499 |
+
ajax : false,
|
7500 |
+
/**
|
7501 |
+
* Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `false`.
|
7502 |
+
* @name $.jstree.defaults.search.fuzzy
|
7503 |
+
* @plugin search
|
7504 |
+
*/
|
7505 |
+
fuzzy : false,
|
7506 |
+
/**
|
7507 |
+
* Indicates if the search should be case sensitive. Default is `false`.
|
7508 |
+
* @name $.jstree.defaults.search.case_sensitive
|
7509 |
+
* @plugin search
|
7510 |
+
*/
|
7511 |
+
case_sensitive : false,
|
7512 |
+
/**
|
7513 |
+
* Indicates if the tree should be filtered (by default) to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers).
|
7514 |
+
* This setting can be changed at runtime when calling the search method. Default is `false`.
|
7515 |
+
* @name $.jstree.defaults.search.show_only_matches
|
7516 |
+
* @plugin search
|
7517 |
+
*/
|
7518 |
+
show_only_matches : false,
|
7519 |
+
/**
|
7520 |
+
* Indicates if the children of matched element are shown (when show_only_matches is true)
|
7521 |
+
* This setting can be changed at runtime when calling the search method. Default is `false`.
|
7522 |
+
* @name $.jstree.defaults.search.show_only_matches_children
|
7523 |
+
* @plugin search
|
7524 |
+
*/
|
7525 |
+
show_only_matches_children : false,
|
7526 |
+
/**
|
7527 |
+
* Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`.
|
7528 |
+
* @name $.jstree.defaults.search.close_opened_onclear
|
7529 |
+
* @plugin search
|
7530 |
+
*/
|
7531 |
+
close_opened_onclear : true,
|
7532 |
+
/**
|
7533 |
+
* Indicates if only leaf nodes should be included in search results. Default is `false`.
|
7534 |
+
* @name $.jstree.defaults.search.search_leaves_only
|
7535 |
+
* @plugin search
|
7536 |
+
*/
|
7537 |
+
search_leaves_only : false,
|
7538 |
+
/**
|
7539 |
+
* If set to a function it wil be called in the instance's scope with two arguments - search string and node (where node will be every node in the structure, so use with caution).
|
7540 |
+
* If the function returns a truthy value the node will be considered a match (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`.
|
7541 |
+
* @name $.jstree.defaults.search.search_callback
|
7542 |
+
* @plugin search
|
7543 |
+
*/
|
7544 |
+
search_callback : false
|
7545 |
+
};
|
7546 |
+
|
7547 |
+
$.jstree.plugins.search = function (options, parent) {
|
7548 |
+
this.bind = function () {
|
7549 |
+
parent.bind.call(this);
|
7550 |
+
|
7551 |
+
this._data.search.str = "";
|
7552 |
+
this._data.search.dom = $();
|
7553 |
+
this._data.search.res = [];
|
7554 |
+
this._data.search.opn = [];
|
7555 |
+
this._data.search.som = false;
|
7556 |
+
this._data.search.smc = false;
|
7557 |
+
this._data.search.hdn = [];
|
7558 |
+
|
7559 |
+
this.element
|
7560 |
+
.on("search.jstree", $.proxy(function (e, data) {
|
7561 |
+
if(this._data.search.som && data.res.length) {
|
7562 |
+
var m = this._model.data, i, j, p = [], k, l;
|
7563 |
+
for(i = 0, j = data.res.length; i < j; i++) {
|
7564 |
+
if(m[data.res[i]] && !m[data.res[i]].state.hidden) {
|
7565 |
+
p.push(data.res[i]);
|
7566 |
+
p = p.concat(m[data.res[i]].parents);
|
7567 |
+
if(this._data.search.smc) {
|
7568 |
+
for (k = 0, l = m[data.res[i]].children_d.length; k < l; k++) {
|
7569 |
+
if (m[m[data.res[i]].children_d[k]] && !m[m[data.res[i]].children_d[k]].state.hidden) {
|
7570 |
+
p.push(m[data.res[i]].children_d[k]);
|
7571 |
+
}
|
7572 |
+
}
|
7573 |
+
}
|
7574 |
+
}
|
7575 |
+
}
|
7576 |
+
p = $.vakata.array_remove_item($.vakata.array_unique(p), $.jstree.root);
|
7577 |
+
this._data.search.hdn = this.hide_all(true);
|
7578 |
+
this.show_node(p, true);
|
7579 |
+
this.redraw(true);
|
7580 |
+
}
|
7581 |
+
}, this))
|
7582 |
+
.on("clear_search.jstree", $.proxy(function (e, data) {
|
7583 |
+
if(this._data.search.som && data.res.length) {
|
7584 |
+
this.show_node(this._data.search.hdn, true);
|
7585 |
+
this.redraw(true);
|
7586 |
+
}
|
7587 |
+
}, this));
|
7588 |
+
};
|
7589 |
+
/**
|
7590 |
+
* used to search the tree nodes for a given string
|
7591 |
+
* @name search(str [, skip_async])
|
7592 |
+
* @param {String} str the search string
|
7593 |
+
* @param {Boolean} skip_async if set to true server will not be queried even if configured
|
7594 |
+
* @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers)
|
7595 |
+
* @param {mixed} inside an optional node to whose children to limit the search
|
7596 |
+
* @param {Boolean} append if set to true the results of this search are appended to the previous search
|
7597 |
+
* @plugin search
|
7598 |
+
* @trigger search.jstree
|
7599 |
+
*/
|
7600 |
+
this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) {
|
7601 |
+
if(str === false || $.trim(str.toString()) === "") {
|
7602 |
+
return this.clear_search();
|
7603 |
+
}
|
7604 |
+
inside = this.get_node(inside);
|
7605 |
+
inside = inside && inside.id ? inside.id : null;
|
7606 |
+
str = str.toString();
|
7607 |
+
var s = this.settings.search,
|
7608 |
+
a = s.ajax ? s.ajax : false,
|
7609 |
+
m = this._model.data,
|
7610 |
+
f = null,
|
7611 |
+
r = [],
|
7612 |
+
p = [], i, j;
|
7613 |
+
if(this._data.search.res.length && !append) {
|
7614 |
+
this.clear_search();
|
7615 |
+
}
|
7616 |
+
if(show_only_matches === undefined) {
|
7617 |
+
show_only_matches = s.show_only_matches;
|
7618 |
+
}
|
7619 |
+
if(show_only_matches_children === undefined) {
|
7620 |
+
show_only_matches_children = s.show_only_matches_children;
|
7621 |
+
}
|
7622 |
+
if(!skip_async && a !== false) {
|
7623 |
+
if($.isFunction(a)) {
|
7624 |
+
return a.call(this, str, $.proxy(function (d) {
|
7625 |
+
if(d && d.d) { d = d.d; }
|
7626 |
+
this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () {
|
7627 |
+
this.search(str, true, show_only_matches, inside, append, show_only_matches_children);
|
7628 |
+
});
|
7629 |
+
}, this), inside);
|
7630 |
+
}
|
7631 |
+
else {
|
7632 |
+
a = $.extend({}, a);
|
7633 |
+
if(!a.data) { a.data = {}; }
|
7634 |
+
a.data.str = str;
|
7635 |
+
if(inside) {
|
7636 |
+
a.data.inside = inside;
|
7637 |
+
}
|
7638 |
+
if (this._data.search.lastRequest) {
|
7639 |
+
this._data.search.lastRequest.abort();
|
7640 |
+
}
|
7641 |
+
this._data.search.lastRequest = $.ajax(a)
|
7642 |
+
.fail($.proxy(function () {
|
7643 |
+
this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) };
|
7644 |
+
this.settings.core.error.call(this, this._data.core.last_error);
|
7645 |
+
}, this))
|
7646 |
+
.done($.proxy(function (d) {
|
7647 |
+
if(d && d.d) { d = d.d; }
|
7648 |
+
this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () {
|
7649 |
+
this.search(str, true, show_only_matches, inside, append, show_only_matches_children);
|
7650 |
+
});
|
7651 |
+
}, this));
|
7652 |
+
return this._data.search.lastRequest;
|
7653 |
+
}
|
7654 |
+
}
|
7655 |
+
if(!append) {
|
7656 |
+
this._data.search.str = str;
|
7657 |
+
this._data.search.dom = $();
|
7658 |
+
this._data.search.res = [];
|
7659 |
+
this._data.search.opn = [];
|
7660 |
+
this._data.search.som = show_only_matches;
|
7661 |
+
this._data.search.smc = show_only_matches_children;
|
7662 |
+
}
|
7663 |
+
|
7664 |
+
f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy });
|
7665 |
+
$.each(m[inside ? inside : $.jstree.root].children_d, function (ii, i) {
|
7666 |
+
var v = m[i];
|
7667 |
+
if(v.text && !v.state.hidden && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) && ( (s.search_callback && s.search_callback.call(this, str, v)) || (!s.search_callback && f.search(v.text).isMatch) ) ) {
|
7668 |
+
r.push(i);
|
7669 |
+
p = p.concat(v.parents);
|
7670 |
+
}
|
7671 |
+
});
|
7672 |
+
if(r.length) {
|
7673 |
+
p = $.vakata.array_unique(p);
|
7674 |
+
for(i = 0, j = p.length; i < j; i++) {
|
7675 |
+
if(p[i] !== $.jstree.root && m[p[i]] && this.open_node(p[i], null, 0) === true) {
|
7676 |
+
this._data.search.opn.push(p[i]);
|
7677 |
+
}
|
7678 |
+
}
|
7679 |
+
if(!append) {
|
7680 |
+
this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')));
|
7681 |
+
this._data.search.res = r;
|
7682 |
+
}
|
7683 |
+
else {
|
7684 |
+
this._data.search.dom = this._data.search.dom.add($(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))));
|
7685 |
+
this._data.search.res = $.vakata.array_unique(this._data.search.res.concat(r));
|
7686 |
+
}
|
7687 |
+
this._data.search.dom.children(".jstree-anchor").addClass('jstree-search');
|
7688 |
+
}
|
7689 |
+
/**
|
7690 |
+
* triggered after search is complete
|
7691 |
+
* @event
|
7692 |
+
* @name search.jstree
|
7693 |
+
* @param {jQuery} nodes a jQuery collection of matching nodes
|
7694 |
+
* @param {String} str the search string
|
7695 |
+
* @param {Array} res a collection of objects represeing the matching nodes
|
7696 |
+
* @plugin search
|
7697 |
+
*/
|
7698 |
+
this.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res, show_only_matches : show_only_matches });
|
7699 |
+
};
|
7700 |
+
/**
|
7701 |
+
* used to clear the last search (removes classes and shows all nodes if filtering is on)
|
7702 |
+
* @name clear_search()
|
7703 |
+
* @plugin search
|
7704 |
+
* @trigger clear_search.jstree
|
7705 |
+
*/
|
7706 |
+
this.clear_search = function () {
|
7707 |
+
if(this.settings.search.close_opened_onclear) {
|
7708 |
+
this.close_node(this._data.search.opn, 0);
|
7709 |
+
}
|
7710 |
+
/**
|
7711 |
+
* triggered after search is complete
|
7712 |
+
* @event
|
7713 |
+
* @name clear_search.jstree
|
7714 |
+
* @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search)
|
7715 |
+
* @param {String} str the search string (the last search string)
|
7716 |
+
* @param {Array} res a collection of objects represeing the matching nodes (the result from the last search)
|
7717 |
+
* @plugin search
|
7718 |
+
*/
|
7719 |
+
this.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res });
|
7720 |
+
if(this._data.search.res.length) {
|
7721 |
+
this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(this._data.search.res, function (v) {
|
7722 |
+
return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&');
|
7723 |
+
}).join(', #')));
|
7724 |
+
this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search");
|
7725 |
+
}
|
7726 |
+
this._data.search.str = "";
|
7727 |
+
this._data.search.res = [];
|
7728 |
+
this._data.search.opn = [];
|
7729 |
+
this._data.search.dom = $();
|
7730 |
+
};
|
7731 |
+
|
7732 |
+
this.redraw_node = function(obj, deep, callback, force_render) {
|
7733 |
+
obj = parent.redraw_node.apply(this, arguments);
|
7734 |
+
if(obj) {
|
7735 |
+
if($.inArray(obj.id, this._data.search.res) !== -1) {
|
7736 |
+
var i, j, tmp = null;
|
7737 |
+
for(i = 0, j = obj.childNodes.length; i < j; i++) {
|
7738 |
+
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
|
7739 |
+
tmp = obj.childNodes[i];
|
7740 |
+
break;
|
7741 |
+
}
|
7742 |
+
}
|
7743 |
+
if(tmp) {
|
7744 |
+
tmp.className += ' jstree-search';
|
7745 |
+
}
|
7746 |
+
}
|
7747 |
+
}
|
7748 |
+
return obj;
|
7749 |
+
};
|
7750 |
+
};
|
7751 |
+
|
7752 |
+
// helpers
|
7753 |
+
(function ($) {
|
7754 |
+
// from http://kiro.me/projects/fuse.html
|
7755 |
+
$.vakata.search = function(pattern, txt, options) {
|
7756 |
+
options = options || {};
|
7757 |
+
options = $.extend({}, $.vakata.search.defaults, options);
|
7758 |
+
if(options.fuzzy !== false) {
|
7759 |
+
options.fuzzy = true;
|
7760 |
+
}
|
7761 |
+
pattern = options.caseSensitive ? pattern : pattern.toLowerCase();
|
7762 |
+
var MATCH_LOCATION = options.location,
|
7763 |
+
MATCH_DISTANCE = options.distance,
|
7764 |
+
MATCH_THRESHOLD = options.threshold,
|
7765 |
+
patternLen = pattern.length,
|
7766 |
+
matchmask, pattern_alphabet, match_bitapScore, search;
|
7767 |
+
if(patternLen > 32) {
|
7768 |
+
options.fuzzy = false;
|
7769 |
+
}
|
7770 |
+
if(options.fuzzy) {
|
7771 |
+
matchmask = 1 << (patternLen - 1);
|
7772 |
+
pattern_alphabet = (function () {
|
7773 |
+
var mask = {},
|
7774 |
+
i = 0;
|
7775 |
+
for (i = 0; i < patternLen; i++) {
|
7776 |
+
mask[pattern.charAt(i)] = 0;
|
7777 |
+
}
|
7778 |
+
for (i = 0; i < patternLen; i++) {
|
7779 |
+
mask[pattern.charAt(i)] |= 1 << (patternLen - i - 1);
|
7780 |
+
}
|
7781 |
+
return mask;
|
7782 |
+
}());
|
7783 |
+
match_bitapScore = function (e, x) {
|
7784 |
+
var accuracy = e / patternLen,
|
7785 |
+
proximity = Math.abs(MATCH_LOCATION - x);
|
7786 |
+
if(!MATCH_DISTANCE) {
|
7787 |
+
return proximity ? 1.0 : accuracy;
|
7788 |
+
}
|
7789 |
+
return accuracy + (proximity / MATCH_DISTANCE);
|
7790 |
+
};
|
7791 |
+
}
|
7792 |
+
search = function (text) {
|
7793 |
+
text = options.caseSensitive ? text : text.toLowerCase();
|
7794 |
+
if(pattern === text || text.indexOf(pattern) !== -1) {
|
7795 |
+
return {
|
7796 |
+
isMatch: true,
|
7797 |
+
score: 0
|
7798 |
+
};
|
7799 |
+
}
|
7800 |
+
if(!options.fuzzy) {
|
7801 |
+
return {
|
7802 |
+
isMatch: false,
|
7803 |
+
score: 1
|
7804 |
+
};
|
7805 |
+
}
|
7806 |
+
var i, j,
|
7807 |
+
textLen = text.length,
|
7808 |
+
scoreThreshold = MATCH_THRESHOLD,
|
7809 |
+
bestLoc = text.indexOf(pattern, MATCH_LOCATION),
|
7810 |
+
binMin, binMid,
|
7811 |
+
binMax = patternLen + textLen,
|
7812 |
+
lastRd, start, finish, rd, charMatch,
|
7813 |
+
score = 1,
|
7814 |
+
locations = [];
|
7815 |
+
if (bestLoc !== -1) {
|
7816 |
+
scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);
|
7817 |
+
bestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen);
|
7818 |
+
if (bestLoc !== -1) {
|
7819 |
+
scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);
|
7820 |
+
}
|
7821 |
+
}
|
7822 |
+
bestLoc = -1;
|
7823 |
+
for (i = 0; i < patternLen; i++) {
|
7824 |
+
binMin = 0;
|
7825 |
+
binMid = binMax;
|
7826 |
+
while (binMin < binMid) {
|
7827 |
+
if (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) {
|
7828 |
+
binMin = binMid;
|
7829 |
+
} else {
|
7830 |
+
binMax = binMid;
|
7831 |
+
}
|
7832 |
+
binMid = Math.floor((binMax - binMin) / 2 + binMin);
|
7833 |
+
}
|
7834 |
+
binMax = binMid;
|
7835 |
+
start = Math.max(1, MATCH_LOCATION - binMid + 1);
|
7836 |
+
finish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen;
|
7837 |
+
rd = new Array(finish + 2);
|
7838 |
+
rd[finish + 1] = (1 << i) - 1;
|
7839 |
+
for (j = finish; j >= start; j--) {
|
7840 |
+
charMatch = pattern_alphabet[text.charAt(j - 1)];
|
7841 |
+
if (i === 0) {
|
7842 |
+
rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;
|
7843 |
+
} else {
|
7844 |
+
rd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1];
|
7845 |
+
}
|
7846 |
+
if (rd[j] & matchmask) {
|
7847 |
+
score = match_bitapScore(i, j - 1);
|
7848 |
+
if (score <= scoreThreshold) {
|
7849 |
+
scoreThreshold = score;
|
7850 |
+
bestLoc = j - 1;
|
7851 |
+
locations.push(bestLoc);
|
7852 |
+
if (bestLoc > MATCH_LOCATION) {
|
7853 |
+
start = Math.max(1, 2 * MATCH_LOCATION - bestLoc);
|
7854 |
+
} else {
|
7855 |
+
break;
|
7856 |
+
}
|
7857 |
+
}
|
7858 |
+
}
|
7859 |
+
}
|
7860 |
+
if (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) {
|
7861 |
+
break;
|
7862 |
+
}
|
7863 |
+
lastRd = rd;
|
7864 |
+
}
|
7865 |
+
return {
|
7866 |
+
isMatch: bestLoc >= 0,
|
7867 |
+
score: score
|
7868 |
+
};
|
7869 |
+
};
|
7870 |
+
return txt === true ? { 'search' : search } : search(txt);
|
7871 |
+
};
|
7872 |
+
$.vakata.search.defaults = {
|
7873 |
+
location : 0,
|
7874 |
+
distance : 100,
|
7875 |
+
threshold : 0.6,
|
7876 |
+
fuzzy : false,
|
7877 |
+
caseSensitive : false
|
7878 |
+
};
|
7879 |
+
}($));
|
7880 |
+
|
7881 |
+
// include the search plugin by default
|
7882 |
+
// $.jstree.defaults.plugins.push("search");
|
7883 |
+
|
7884 |
+
|
7885 |
+
/**
|
7886 |
+
* ### Sort plugin
|
7887 |
+
*
|
7888 |
+
* Automatically sorts all siblings in the tree according to a sorting function.
|
7889 |
+
*/
|
7890 |
+
|
7891 |
+
/**
|
7892 |
+
* the settings function used to sort the nodes.
|
7893 |
+
* It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`.
|
7894 |
+
* @name $.jstree.defaults.sort
|
7895 |
+
* @plugin sort
|
7896 |
+
*/
|
7897 |
+
$.jstree.defaults.sort = function (a, b) {
|
7898 |
+
//return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b);
|
7899 |
+
return this.get_text(a) > this.get_text(b) ? 1 : -1;
|
7900 |
+
};
|
7901 |
+
$.jstree.plugins.sort = function (options, parent) {
|
7902 |
+
this.bind = function () {
|
7903 |
+
parent.bind.call(this);
|
7904 |
+
this.element
|
7905 |
+
.on("model.jstree", $.proxy(function (e, data) {
|
7906 |
+
this.sort(data.parent, true);
|
7907 |
+
}, this))
|
7908 |
+
.on("rename_node.jstree create_node.jstree", $.proxy(function (e, data) {
|
7909 |
+
this.sort(data.parent || data.node.parent, false);
|
7910 |
+
this.redraw_node(data.parent || data.node.parent, true);
|
7911 |
+
}, this))
|
7912 |
+
.on("move_node.jstree copy_node.jstree", $.proxy(function (e, data) {
|
7913 |
+
this.sort(data.parent, false);
|
7914 |
+
this.redraw_node(data.parent, true);
|
7915 |
+
}, this));
|
7916 |
+
};
|
7917 |
+
/**
|
7918 |
+
* used to sort a node's children
|
7919 |
+
* @private
|
7920 |
+
* @name sort(obj [, deep])
|
7921 |
+
* @param {mixed} obj the node
|
7922 |
+
* @param {Boolean} deep if set to `true` nodes are sorted recursively.
|
7923 |
+
* @plugin sort
|
7924 |
+
* @trigger search.jstree
|
7925 |
+
*/
|
7926 |
+
this.sort = function (obj, deep) {
|
7927 |
+
var i, j;
|
7928 |
+
obj = this.get_node(obj);
|
7929 |
+
if(obj && obj.children && obj.children.length) {
|
7930 |
+
obj.children.sort($.proxy(this.settings.sort, this));
|
7931 |
+
if(deep) {
|
7932 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
7933 |
+
this.sort(obj.children_d[i], false);
|
7934 |
+
}
|
7935 |
+
}
|
7936 |
+
}
|
7937 |
+
};
|
7938 |
+
};
|
7939 |
+
|
7940 |
+
// include the sort plugin by default
|
7941 |
+
// $.jstree.defaults.plugins.push("sort");
|
7942 |
+
|
7943 |
+
/**
|
7944 |
+
* ### State plugin
|
7945 |
+
*
|
7946 |
+
* Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc)
|
7947 |
+
*/
|
7948 |
+
|
7949 |
+
var to = false;
|
7950 |
+
/**
|
7951 |
+
* stores all defaults for the state plugin
|
7952 |
+
* @name $.jstree.defaults.state
|
7953 |
+
* @plugin state
|
7954 |
+
*/
|
7955 |
+
$.jstree.defaults.state = {
|
7956 |
+
/**
|
7957 |
+
* A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`.
|
7958 |
+
* @name $.jstree.defaults.state.key
|
7959 |
+
* @plugin state
|
7960 |
+
*/
|
7961 |
+
key : 'jstree',
|
7962 |
+
/**
|
7963 |
+
* A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`.
|
7964 |
+
* @name $.jstree.defaults.state.events
|
7965 |
+
* @plugin state
|
7966 |
+
*/
|
7967 |
+
events : 'changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree',
|
7968 |
+
/**
|
7969 |
+
* Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire.
|
7970 |
+
* @name $.jstree.defaults.state.ttl
|
7971 |
+
* @plugin state
|
7972 |
+
*/
|
7973 |
+
ttl : false,
|
7974 |
+
/**
|
7975 |
+
* A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state.
|
7976 |
+
* @name $.jstree.defaults.state.filter
|
7977 |
+
* @plugin state
|
7978 |
+
*/
|
7979 |
+
filter : false,
|
7980 |
+
/**
|
7981 |
+
* Should loaded nodes be restored (setting this to true means that it is possible that the whole tree will be loaded for some users - use with caution). Defaults to `false`
|
7982 |
+
* @name $.jstree.defaults.state.preserve_loaded
|
7983 |
+
* @plugin state
|
7984 |
+
*/
|
7985 |
+
preserve_loaded : false
|
7986 |
+
};
|
7987 |
+
$.jstree.plugins.state = function (options, parent) {
|
7988 |
+
this.bind = function () {
|
7989 |
+
parent.bind.call(this);
|
7990 |
+
var bind = $.proxy(function () {
|
7991 |
+
this.element.on(this.settings.state.events, $.proxy(function () {
|
7992 |
+
if(to) { clearTimeout(to); }
|
7993 |
+
to = setTimeout($.proxy(function () { this.save_state(); }, this), 100);
|
7994 |
+
}, this));
|
7995 |
+
/**
|
7996 |
+
* triggered when the state plugin is finished restoring the state (and immediately after ready if there is no state to restore).
|
7997 |
+
* @event
|
7998 |
+
* @name state_ready.jstree
|
7999 |
+
* @plugin state
|
8000 |
+
*/
|
8001 |
+
this.trigger('state_ready');
|
8002 |
+
}, this);
|
8003 |
+
this.element
|
8004 |
+
.on("ready.jstree", $.proxy(function (e, data) {
|
8005 |
+
this.element.one("restore_state.jstree", bind);
|
8006 |
+
if(!this.restore_state()) { bind(); }
|
8007 |
+
}, this));
|
8008 |
+
};
|
8009 |
+
/**
|
8010 |
+
* save the state
|
8011 |
+
* @name save_state()
|
8012 |
+
* @plugin state
|
8013 |
+
*/
|
8014 |
+
this.save_state = function () {
|
8015 |
+
var tm = this.get_state();
|
8016 |
+
if (!this.settings.state.preserve_loaded) {
|
8017 |
+
delete tm.core.loaded;
|
8018 |
+
}
|
8019 |
+
var st = { 'state' : tm, 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) };
|
8020 |
+
$.vakata.storage.set(this.settings.state.key, JSON.stringify(st));
|
8021 |
+
};
|
8022 |
+
/**
|
8023 |
+
* restore the state from the user's computer
|
8024 |
+
* @name restore_state()
|
8025 |
+
* @plugin state
|
8026 |
+
*/
|
8027 |
+
this.restore_state = function () {
|
8028 |
+
var k = $.vakata.storage.get(this.settings.state.key);
|
8029 |
+
if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } }
|
8030 |
+
if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; }
|
8031 |
+
if(!!k && k.state) { k = k.state; }
|
8032 |
+
if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); }
|
8033 |
+
if(!!k) {
|
8034 |
+
if (!this.settings.state.preserve_loaded) {
|
8035 |
+
delete k.core.loaded;
|
8036 |
+
}
|
8037 |
+
this.element.one("set_state.jstree", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); });
|
8038 |
+
this.set_state(k);
|
8039 |
+
return true;
|
8040 |
+
}
|
8041 |
+
return false;
|
8042 |
+
};
|
8043 |
+
/**
|
8044 |
+
* clear the state on the user's computer
|
8045 |
+
* @name clear_state()
|
8046 |
+
* @plugin state
|
8047 |
+
*/
|
8048 |
+
this.clear_state = function () {
|
8049 |
+
return $.vakata.storage.del(this.settings.state.key);
|
8050 |
+
};
|
8051 |
+
};
|
8052 |
+
|
8053 |
+
(function ($, undefined) {
|
8054 |
+
$.vakata.storage = {
|
8055 |
+
// simply specifying the functions in FF throws an error
|
8056 |
+
set : function (key, val) { return window.localStorage.setItem(key, val); },
|
8057 |
+
get : function (key) { return window.localStorage.getItem(key); },
|
8058 |
+
del : function (key) { return window.localStorage.removeItem(key); }
|
8059 |
+
};
|
8060 |
+
}($));
|
8061 |
+
|
8062 |
+
// include the state plugin by default
|
8063 |
+
// $.jstree.defaults.plugins.push("state");
|
8064 |
+
|
8065 |
+
/**
|
8066 |
+
* ### Types plugin
|
8067 |
+
*
|
8068 |
+
* Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group.
|
8069 |
+
*/
|
8070 |
+
|
8071 |
+
/**
|
8072 |
+
* An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional).
|
8073 |
+
*
|
8074 |
+
* * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited.
|
8075 |
+
* * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited.
|
8076 |
+
* * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits.
|
8077 |
+
* * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme.
|
8078 |
+
* * `li_attr` an object of values which will be used to add HTML attributes on the resulting LI DOM node (merged with the node's own data)
|
8079 |
+
* * `a_attr` an object of values which will be used to add HTML attributes on the resulting A DOM node (merged with the node's own data)
|
8080 |
+
*
|
8081 |
+
* There are two predefined types:
|
8082 |
+
*
|
8083 |
+
* * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes.
|
8084 |
+
* * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified.
|
8085 |
+
*
|
8086 |
+
* @name $.jstree.defaults.types
|
8087 |
+
* @plugin types
|
8088 |
+
*/
|
8089 |
+
$.jstree.defaults.types = {
|
8090 |
+
'default' : {}
|
8091 |
+
};
|
8092 |
+
$.jstree.defaults.types[$.jstree.root] = {};
|
8093 |
+
|
8094 |
+
$.jstree.plugins.types = function (options, parent) {
|
8095 |
+
this.init = function (el, options) {
|
8096 |
+
var i, j;
|
8097 |
+
if(options && options.types && options.types['default']) {
|
8098 |
+
for(i in options.types) {
|
8099 |
+
if(i !== "default" && i !== $.jstree.root && options.types.hasOwnProperty(i)) {
|
8100 |
+
for(j in options.types['default']) {
|
8101 |
+
if(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) {
|
8102 |
+
options.types[i][j] = options.types['default'][j];
|
8103 |
+
}
|
8104 |
+
}
|
8105 |
+
}
|
8106 |
+
}
|
8107 |
+
}
|
8108 |
+
parent.init.call(this, el, options);
|
8109 |
+
this._model.data[$.jstree.root].type = $.jstree.root;
|
8110 |
+
};
|
8111 |
+
this.refresh = function (skip_loading, forget_state) {
|
8112 |
+
parent.refresh.call(this, skip_loading, forget_state);
|
8113 |
+
this._model.data[$.jstree.root].type = $.jstree.root;
|
8114 |
+
};
|
8115 |
+
this.bind = function () {
|
8116 |
+
this.element
|
8117 |
+
.on('model.jstree', $.proxy(function (e, data) {
|
8118 |
+
var m = this._model.data,
|
8119 |
+
dpc = data.nodes,
|
8120 |
+
t = this.settings.types,
|
8121 |
+
i, j, c = 'default', k;
|
8122 |
+
for(i = 0, j = dpc.length; i < j; i++) {
|
8123 |
+
c = 'default';
|
8124 |
+
if(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) {
|
8125 |
+
c = m[dpc[i]].original.type;
|
8126 |
+
}
|
8127 |
+
if(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) {
|
8128 |
+
c = m[dpc[i]].data.jstree.type;
|
8129 |
+
}
|
8130 |
+
m[dpc[i]].type = c;
|
8131 |
+
if(m[dpc[i]].icon === true && t[c].icon !== undefined) {
|
8132 |
+
m[dpc[i]].icon = t[c].icon;
|
8133 |
+
}
|
8134 |
+
if(t[c].li_attr !== undefined && typeof t[c].li_attr === 'object') {
|
8135 |
+
for (k in t[c].li_attr) {
|
8136 |
+
if (t[c].li_attr.hasOwnProperty(k)) {
|
8137 |
+
if (k === 'id') {
|
8138 |
+
continue;
|
8139 |
+
}
|
8140 |
+
else if (m[dpc[i]].li_attr[k] === undefined) {
|
8141 |
+
m[dpc[i]].li_attr[k] = t[c].li_attr[k];
|
8142 |
+
}
|
8143 |
+
else if (k === 'class') {
|
8144 |
+
m[dpc[i]].li_attr['class'] = t[c].li_attr['class'] + ' ' + m[dpc[i]].li_attr['class'];
|
8145 |
+
}
|
8146 |
+
}
|
8147 |
+
}
|
8148 |
+
}
|
8149 |
+
if(t[c].a_attr !== undefined && typeof t[c].a_attr === 'object') {
|
8150 |
+
for (k in t[c].a_attr) {
|
8151 |
+
if (t[c].a_attr.hasOwnProperty(k)) {
|
8152 |
+
if (k === 'id') {
|
8153 |
+
continue;
|
8154 |
+
}
|
8155 |
+
else if (m[dpc[i]].a_attr[k] === undefined) {
|
8156 |
+
m[dpc[i]].a_attr[k] = t[c].a_attr[k];
|
8157 |
+
}
|
8158 |
+
else if (k === 'href' && m[dpc[i]].a_attr[k] === '#') {
|
8159 |
+
m[dpc[i]].a_attr['href'] = t[c].a_attr['href'];
|
8160 |
+
}
|
8161 |
+
else if (k === 'class') {
|
8162 |
+
m[dpc[i]].a_attr['class'] = t[c].a_attr['class'] + ' ' + m[dpc[i]].a_attr['class'];
|
8163 |
+
}
|
8164 |
+
}
|
8165 |
+
}
|
8166 |
+
}
|
8167 |
+
}
|
8168 |
+
m[$.jstree.root].type = $.jstree.root;
|
8169 |
+
}, this));
|
8170 |
+
parent.bind.call(this);
|
8171 |
+
};
|
8172 |
+
this.get_json = function (obj, options, flat) {
|
8173 |
+
var i, j,
|
8174 |
+
m = this._model.data,
|
8175 |
+
opt = options ? $.extend(true, {}, options, {no_id:false}) : {},
|
8176 |
+
tmp = parent.get_json.call(this, obj, opt, flat);
|
8177 |
+
if(tmp === false) { return false; }
|
8178 |
+
if($.isArray(tmp)) {
|
8179 |
+
for(i = 0, j = tmp.length; i < j; i++) {
|
8180 |
+
tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default";
|
8181 |
+
if(options && options.no_id) {
|
8182 |
+
delete tmp[i].id;
|
8183 |
+
if(tmp[i].li_attr && tmp[i].li_attr.id) {
|
8184 |
+
delete tmp[i].li_attr.id;
|
8185 |
+
}
|
8186 |
+
if(tmp[i].a_attr && tmp[i].a_attr.id) {
|
8187 |
+
delete tmp[i].a_attr.id;
|
8188 |
+
}
|
8189 |
+
}
|
8190 |
+
}
|
8191 |
+
}
|
8192 |
+
else {
|
8193 |
+
tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default";
|
8194 |
+
if(options && options.no_id) {
|
8195 |
+
tmp = this._delete_ids(tmp);
|
8196 |
+
}
|
8197 |
+
}
|
8198 |
+
return tmp;
|
8199 |
+
};
|
8200 |
+
this._delete_ids = function (tmp) {
|
8201 |
+
if($.isArray(tmp)) {
|
8202 |
+
for(var i = 0, j = tmp.length; i < j; i++) {
|
8203 |
+
tmp[i] = this._delete_ids(tmp[i]);
|
8204 |
+
}
|
8205 |
+
return tmp;
|
8206 |
+
}
|
8207 |
+
delete tmp.id;
|
8208 |
+
if(tmp.li_attr && tmp.li_attr.id) {
|
8209 |
+
delete tmp.li_attr.id;
|
8210 |
+
}
|
8211 |
+
if(tmp.a_attr && tmp.a_attr.id) {
|
8212 |
+
delete tmp.a_attr.id;
|
8213 |
+
}
|
8214 |
+
if(tmp.children && $.isArray(tmp.children)) {
|
8215 |
+
tmp.children = this._delete_ids(tmp.children);
|
8216 |
+
}
|
8217 |
+
return tmp;
|
8218 |
+
};
|
8219 |
+
this.check = function (chk, obj, par, pos, more) {
|
8220 |
+
if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }
|
8221 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
8222 |
+
par = par && par.id ? par : this.get_node(par);
|
8223 |
+
var m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j;
|
8224 |
+
m = m && m._model && m._model.data ? m._model.data : null;
|
8225 |
+
switch(chk) {
|
8226 |
+
case "create_node":
|
8227 |
+
case "move_node":
|
8228 |
+
case "copy_node":
|
8229 |
+
if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) {
|
8230 |
+
tmp = this.get_rules(par);
|
8231 |
+
if(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) {
|
8232 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8233 |
+
return false;
|
8234 |
+
}
|
8235 |
+
if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), tmp.valid_children) === -1) {
|
8236 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8237 |
+
return false;
|
8238 |
+
}
|
8239 |
+
if(m && obj.children_d && obj.parents) {
|
8240 |
+
d = 0;
|
8241 |
+
for(i = 0, j = obj.children_d.length; i < j; i++) {
|
8242 |
+
d = Math.max(d, m[obj.children_d[i]].parents.length);
|
8243 |
+
}
|
8244 |
+
d = d - obj.parents.length + 1;
|
8245 |
+
}
|
8246 |
+
if(d <= 0 || d === undefined) { d = 1; }
|
8247 |
+
do {
|
8248 |
+
if(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) {
|
8249 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8250 |
+
return false;
|
8251 |
+
}
|
8252 |
+
par = this.get_node(par.parent);
|
8253 |
+
tmp = this.get_rules(par);
|
8254 |
+
d++;
|
8255 |
+
} while(par);
|
8256 |
+
}
|
8257 |
+
break;
|
8258 |
+
}
|
8259 |
+
return true;
|
8260 |
+
};
|
8261 |
+
/**
|
8262 |
+
* used to retrieve the type settings object for a node
|
8263 |
+
* @name get_rules(obj)
|
8264 |
+
* @param {mixed} obj the node to find the rules for
|
8265 |
+
* @return {Object}
|
8266 |
+
* @plugin types
|
8267 |
+
*/
|
8268 |
+
this.get_rules = function (obj) {
|
8269 |
+
obj = this.get_node(obj);
|
8270 |
+
if(!obj) { return false; }
|
8271 |
+
var tmp = this.get_type(obj, true);
|
8272 |
+
if(tmp.max_depth === undefined) { tmp.max_depth = -1; }
|
8273 |
+
if(tmp.max_children === undefined) { tmp.max_children = -1; }
|
8274 |
+
if(tmp.valid_children === undefined) { tmp.valid_children = -1; }
|
8275 |
+
return tmp;
|
8276 |
+
};
|
8277 |
+
/**
|
8278 |
+
* used to retrieve the type string or settings object for a node
|
8279 |
+
* @name get_type(obj [, rules])
|
8280 |
+
* @param {mixed} obj the node to find the rules for
|
8281 |
+
* @param {Boolean} rules if set to `true` instead of a string the settings object will be returned
|
8282 |
+
* @return {String|Object}
|
8283 |
+
* @plugin types
|
8284 |
+
*/
|
8285 |
+
this.get_type = function (obj, rules) {
|
8286 |
+
obj = this.get_node(obj);
|
8287 |
+
return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type);
|
8288 |
+
};
|
8289 |
+
/**
|
8290 |
+
* used to change a node's type
|
8291 |
+
* @name set_type(obj, type)
|
8292 |
+
* @param {mixed} obj the node to change
|
8293 |
+
* @param {String} type the new type
|
8294 |
+
* @plugin types
|
8295 |
+
*/
|
8296 |
+
this.set_type = function (obj, type) {
|
8297 |
+
var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a;
|
8298 |
+
if($.isArray(obj)) {
|
8299 |
+
obj = obj.slice();
|
8300 |
+
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
|
8301 |
+
this.set_type(obj[t1], type);
|
8302 |
+
}
|
8303 |
+
return true;
|
8304 |
+
}
|
8305 |
+
t = this.settings.types;
|
8306 |
+
obj = this.get_node(obj);
|
8307 |
+
if(!t[type] || !obj) { return false; }
|
8308 |
+
d = this.get_node(obj, true);
|
8309 |
+
if (d && d.length) {
|
8310 |
+
a = d.children('.jstree-anchor');
|
8311 |
+
}
|
8312 |
+
old_type = obj.type;
|
8313 |
+
old_icon = this.get_icon(obj);
|
8314 |
+
obj.type = type;
|
8315 |
+
if(old_icon === true || !t[old_type] || (t[old_type].icon !== undefined && old_icon === t[old_type].icon)) {
|
8316 |
+
this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true);
|
8317 |
+
}
|
8318 |
+
|
8319 |
+
// remove old type props
|
8320 |
+
if(t[old_type] && t[old_type].li_attr !== undefined && typeof t[old_type].li_attr === 'object') {
|
8321 |
+
for (k in t[old_type].li_attr) {
|
8322 |
+
if (t[old_type].li_attr.hasOwnProperty(k)) {
|
8323 |
+
if (k === 'id') {
|
8324 |
+
continue;
|
8325 |
+
}
|
8326 |
+
else if (k === 'class') {
|
8327 |
+
m[obj.id].li_attr['class'] = (m[obj.id].li_attr['class'] || '').replace(t[old_type].li_attr[k], '');
|
8328 |
+
if (d) { d.removeClass(t[old_type].li_attr[k]); }
|
8329 |
+
}
|
8330 |
+
else if (m[obj.id].li_attr[k] === t[old_type].li_attr[k]) {
|
8331 |
+
m[obj.id].li_attr[k] = null;
|
8332 |
+
if (d) { d.removeAttr(k); }
|
8333 |
+
}
|
8334 |
+
}
|
8335 |
+
}
|
8336 |
+
}
|
8337 |
+
if(t[old_type] && t[old_type].a_attr !== undefined && typeof t[old_type].a_attr === 'object') {
|
8338 |
+
for (k in t[old_type].a_attr) {
|
8339 |
+
if (t[old_type].a_attr.hasOwnProperty(k)) {
|
8340 |
+
if (k === 'id') {
|
8341 |
+
continue;
|
8342 |
+
}
|
8343 |
+
else if (k === 'class') {
|
8344 |
+
m[obj.id].a_attr['class'] = (m[obj.id].a_attr['class'] || '').replace(t[old_type].a_attr[k], '');
|
8345 |
+
if (a) { a.removeClass(t[old_type].a_attr[k]); }
|
8346 |
+
}
|
8347 |
+
else if (m[obj.id].a_attr[k] === t[old_type].a_attr[k]) {
|
8348 |
+
if (k === 'href') {
|
8349 |
+
m[obj.id].a_attr[k] = '#';
|
8350 |
+
if (a) { a.attr('href', '#'); }
|
8351 |
+
}
|
8352 |
+
else {
|
8353 |
+
delete m[obj.id].a_attr[k];
|
8354 |
+
if (a) { a.removeAttr(k); }
|
8355 |
+
}
|
8356 |
+
}
|
8357 |
+
}
|
8358 |
+
}
|
8359 |
+
}
|
8360 |
+
|
8361 |
+
// add new props
|
8362 |
+
if(t[type].li_attr !== undefined && typeof t[type].li_attr === 'object') {
|
8363 |
+
for (k in t[type].li_attr) {
|
8364 |
+
if (t[type].li_attr.hasOwnProperty(k)) {
|
8365 |
+
if (k === 'id') {
|
8366 |
+
continue;
|
8367 |
+
}
|
8368 |
+
else if (m[obj.id].li_attr[k] === undefined) {
|
8369 |
+
m[obj.id].li_attr[k] = t[type].li_attr[k];
|
8370 |
+
if (d) {
|
8371 |
+
if (k === 'class') {
|
8372 |
+
d.addClass(t[type].li_attr[k]);
|
8373 |
+
}
|
8374 |
+
else {
|
8375 |
+
d.attr(k, t[type].li_attr[k]);
|
8376 |
+
}
|
8377 |
+
}
|
8378 |
+
}
|
8379 |
+
else if (k === 'class') {
|
8380 |
+
m[obj.id].li_attr['class'] = t[type].li_attr[k] + ' ' + m[obj.id].li_attr['class'];
|
8381 |
+
if (d) { d.addClass(t[type].li_attr[k]); }
|
8382 |
+
}
|
8383 |
+
}
|
8384 |
+
}
|
8385 |
+
}
|
8386 |
+
if(t[type].a_attr !== undefined && typeof t[type].a_attr === 'object') {
|
8387 |
+
for (k in t[type].a_attr) {
|
8388 |
+
if (t[type].a_attr.hasOwnProperty(k)) {
|
8389 |
+
if (k === 'id') {
|
8390 |
+
continue;
|
8391 |
+
}
|
8392 |
+
else if (m[obj.id].a_attr[k] === undefined) {
|
8393 |
+
m[obj.id].a_attr[k] = t[type].a_attr[k];
|
8394 |
+
if (a) {
|
8395 |
+
if (k === 'class') {
|
8396 |
+
a.addClass(t[type].a_attr[k]);
|
8397 |
+
}
|
8398 |
+
else {
|
8399 |
+
a.attr(k, t[type].a_attr[k]);
|
8400 |
+
}
|
8401 |
+
}
|
8402 |
+
}
|
8403 |
+
else if (k === 'href' && m[obj.id].a_attr[k] === '#') {
|
8404 |
+
m[obj.id].a_attr['href'] = t[type].a_attr['href'];
|
8405 |
+
if (a) { a.attr('href', t[type].a_attr['href']); }
|
8406 |
+
}
|
8407 |
+
else if (k === 'class') {
|
8408 |
+
m[obj.id].a_attr['class'] = t[type].a_attr['class'] + ' ' + m[obj.id].a_attr['class'];
|
8409 |
+
if (a) { a.addClass(t[type].a_attr[k]); }
|
8410 |
+
}
|
8411 |
+
}
|
8412 |
+
}
|
8413 |
+
}
|
8414 |
+
|
8415 |
+
return true;
|
8416 |
+
};
|
8417 |
+
};
|
8418 |
+
// include the types plugin by default
|
8419 |
+
// $.jstree.defaults.plugins.push("types");
|
8420 |
+
|
8421 |
+
|
8422 |
+
/**
|
8423 |
+
* ### Unique plugin
|
8424 |
+
*
|
8425 |
+
* Enforces that no nodes with the same name can coexist as siblings.
|
8426 |
+
*/
|
8427 |
+
|
8428 |
+
/**
|
8429 |
+
* stores all defaults for the unique plugin
|
8430 |
+
* @name $.jstree.defaults.unique
|
8431 |
+
* @plugin unique
|
8432 |
+
*/
|
8433 |
+
$.jstree.defaults.unique = {
|
8434 |
+
/**
|
8435 |
+
* Indicates if the comparison should be case sensitive. Default is `false`.
|
8436 |
+
* @name $.jstree.defaults.unique.case_sensitive
|
8437 |
+
* @plugin unique
|
8438 |
+
*/
|
8439 |
+
case_sensitive : false,
|
8440 |
+
/**
|
8441 |
+
* Indicates if white space should be trimmed before the comparison. Default is `false`.
|
8442 |
+
* @name $.jstree.defaults.unique.trim_whitespace
|
8443 |
+
* @plugin unique
|
8444 |
+
*/
|
8445 |
+
trim_whitespace : false,
|
8446 |
+
/**
|
8447 |
+
* A callback executed in the instance's scope when a new node is created and the name is already taken, the two arguments are the conflicting name and the counter. The default will produce results like `New node (2)`.
|
8448 |
+
* @name $.jstree.defaults.unique.duplicate
|
8449 |
+
* @plugin unique
|
8450 |
+
*/
|
8451 |
+
duplicate : function (name, counter) {
|
8452 |
+
return name + ' (' + counter + ')';
|
8453 |
+
}
|
8454 |
+
};
|
8455 |
+
|
8456 |
+
$.jstree.plugins.unique = function (options, parent) {
|
8457 |
+
this.check = function (chk, obj, par, pos, more) {
|
8458 |
+
if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }
|
8459 |
+
obj = obj && obj.id ? obj : this.get_node(obj);
|
8460 |
+
par = par && par.id ? par : this.get_node(par);
|
8461 |
+
if(!par || !par.children) { return true; }
|
8462 |
+
var n = chk === "rename_node" ? pos : obj.text,
|
8463 |
+
c = [],
|
8464 |
+
s = this.settings.unique.case_sensitive,
|
8465 |
+
w = this.settings.unique.trim_whitespace,
|
8466 |
+
m = this._model.data, i, j, t;
|
8467 |
+
for(i = 0, j = par.children.length; i < j; i++) {
|
8468 |
+
t = m[par.children[i]].text;
|
8469 |
+
if (!s) {
|
8470 |
+
t = t.toLowerCase();
|
8471 |
+
}
|
8472 |
+
if (w) {
|
8473 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8474 |
+
}
|
8475 |
+
c.push(t);
|
8476 |
+
}
|
8477 |
+
if(!s) { n = n.toLowerCase(); }
|
8478 |
+
if (w) { n = n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); }
|
8479 |
+
switch(chk) {
|
8480 |
+
case "delete_node":
|
8481 |
+
return true;
|
8482 |
+
case "rename_node":
|
8483 |
+
t = obj.text || '';
|
8484 |
+
if (!s) {
|
8485 |
+
t = t.toLowerCase();
|
8486 |
+
}
|
8487 |
+
if (w) {
|
8488 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8489 |
+
}
|
8490 |
+
i = ($.inArray(n, c) === -1 || (obj.text && t === n));
|
8491 |
+
if(!i) {
|
8492 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8493 |
+
}
|
8494 |
+
return i;
|
8495 |
+
case "create_node":
|
8496 |
+
i = ($.inArray(n, c) === -1);
|
8497 |
+
if(!i) {
|
8498 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8499 |
+
}
|
8500 |
+
return i;
|
8501 |
+
case "copy_node":
|
8502 |
+
i = ($.inArray(n, c) === -1);
|
8503 |
+
if(!i) {
|
8504 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8505 |
+
}
|
8506 |
+
return i;
|
8507 |
+
case "move_node":
|
8508 |
+
i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1);
|
8509 |
+
if(!i) {
|
8510 |
+
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
|
8511 |
+
}
|
8512 |
+
return i;
|
8513 |
+
}
|
8514 |
+
return true;
|
8515 |
+
};
|
8516 |
+
this.create_node = function (par, node, pos, callback, is_loaded) {
|
8517 |
+
if(!node || node.text === undefined) {
|
8518 |
+
if(par === null) {
|
8519 |
+
par = $.jstree.root;
|
8520 |
+
}
|
8521 |
+
par = this.get_node(par);
|
8522 |
+
if(!par) {
|
8523 |
+
return parent.create_node.call(this, par, node, pos, callback, is_loaded);
|
8524 |
+
}
|
8525 |
+
pos = pos === undefined ? "last" : pos;
|
8526 |
+
if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
|
8527 |
+
return parent.create_node.call(this, par, node, pos, callback, is_loaded);
|
8528 |
+
}
|
8529 |
+
if(!node) { node = {}; }
|
8530 |
+
var tmp, n, dpc, i, j, m = this._model.data, s = this.settings.unique.case_sensitive, w = this.settings.unique.trim_whitespace, cb = this.settings.unique.duplicate, t;
|
8531 |
+
n = tmp = this.get_string('New node');
|
8532 |
+
dpc = [];
|
8533 |
+
for(i = 0, j = par.children.length; i < j; i++) {
|
8534 |
+
t = m[par.children[i]].text;
|
8535 |
+
if (!s) {
|
8536 |
+
t = t.toLowerCase();
|
8537 |
+
}
|
8538 |
+
if (w) {
|
8539 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8540 |
+
}
|
8541 |
+
dpc.push(t);
|
8542 |
+
}
|
8543 |
+
i = 1;
|
8544 |
+
t = n;
|
8545 |
+
if (!s) {
|
8546 |
+
t = t.toLowerCase();
|
8547 |
+
}
|
8548 |
+
if (w) {
|
8549 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8550 |
+
}
|
8551 |
+
while($.inArray(t, dpc) !== -1) {
|
8552 |
+
n = cb.call(this, tmp, (++i)).toString();
|
8553 |
+
t = n;
|
8554 |
+
if (!s) {
|
8555 |
+
t = t.toLowerCase();
|
8556 |
+
}
|
8557 |
+
if (w) {
|
8558 |
+
t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
8559 |
+
}
|
8560 |
+
}
|
8561 |
+
node.text = n;
|
8562 |
+
}
|
8563 |
+
return parent.create_node.call(this, par, node, pos, callback, is_loaded);
|
8564 |
+
};
|
8565 |
+
};
|
8566 |
+
|
8567 |
+
// include the unique plugin by default
|
8568 |
+
// $.jstree.defaults.plugins.push("unique");
|
8569 |
+
|
8570 |
+
|
8571 |
+
/**
|
8572 |
+
* ### Wholerow plugin
|
8573 |
+
*
|
8574 |
+
* Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers.
|
8575 |
+
*/
|
8576 |
+
|
8577 |
+
var div = document.createElement('DIV');
|
8578 |
+
div.setAttribute('unselectable','on');
|
8579 |
+
div.setAttribute('role','presentation');
|
8580 |
+
div.className = 'jstree-wholerow';
|
8581 |
+
div.innerHTML = ' ';
|
8582 |
+
$.jstree.plugins.wholerow = function (options, parent) {
|
8583 |
+
this.bind = function () {
|
8584 |
+
parent.bind.call(this);
|
8585 |
+
|
8586 |
+
this.element
|
8587 |
+
.on('ready.jstree set_state.jstree', $.proxy(function () {
|
8588 |
+
this.hide_dots();
|
8589 |
+
}, this))
|
8590 |
+
.on("init.jstree loading.jstree ready.jstree", $.proxy(function () {
|
8591 |
+
//div.style.height = this._data.core.li_height + 'px';
|
8592 |
+
this.get_container_ul().addClass('jstree-wholerow-ul');
|
8593 |
+
}, this))
|
8594 |
+
.on("deselect_all.jstree", $.proxy(function (e, data) {
|
8595 |
+
this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');
|
8596 |
+
}, this))
|
8597 |
+
.on("changed.jstree", $.proxy(function (e, data) {
|
8598 |
+
this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');
|
8599 |
+
var tmp = false, i, j;
|
8600 |
+
for(i = 0, j = data.selected.length; i < j; i++) {
|
8601 |
+
tmp = this.get_node(data.selected[i], true);
|
8602 |
+
if(tmp && tmp.length) {
|
8603 |
+
tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked');
|
8604 |
+
}
|
8605 |
+
}
|
8606 |
+
}, this))
|
8607 |
+
.on("open_node.jstree", $.proxy(function (e, data) {
|
8608 |
+
this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked');
|
8609 |
+
}, this))
|
8610 |
+
.on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) {
|
8611 |
+
if(e.type === "hover_node" && this.is_disabled(data.node)) { return; }
|
8612 |
+
this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered');
|
8613 |
+
}, this))
|
8614 |
+
.on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) {
|
8615 |
+
if (this._data.contextmenu) {
|
8616 |
+
e.preventDefault();
|
8617 |
+
var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY });
|
8618 |
+
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp);
|
8619 |
+
}
|
8620 |
+
}, this))
|
8621 |
+
/*!
|
8622 |
+
.on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) {
|
8623 |
+
if(e.target === e.currentTarget) {
|
8624 |
+
var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor");
|
8625 |
+
e.target = a[0];
|
8626 |
+
a.trigger(e);
|
8627 |
+
}
|
8628 |
+
})
|
8629 |
+
*/
|
8630 |
+
.on("click.jstree", ".jstree-wholerow", function (e) {
|
8631 |
+
e.stopImmediatePropagation();
|
8632 |
+
var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
|
8633 |
+
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus();
|
8634 |
+
})
|
8635 |
+
.on("dblclick.jstree", ".jstree-wholerow", function (e) {
|
8636 |
+
e.stopImmediatePropagation();
|
8637 |
+
var tmp = $.Event('dblclick', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
|
8638 |
+
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus();
|
8639 |
+
})
|
8640 |
+
.on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) {
|
8641 |
+
e.stopImmediatePropagation();
|
8642 |
+
var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
|
8643 |
+
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus();
|
8644 |
+
}, this))
|
8645 |
+
.on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) {
|
8646 |
+
e.stopImmediatePropagation();
|
8647 |
+
if(!this.is_disabled(e.currentTarget)) {
|
8648 |
+
this.hover_node(e.currentTarget);
|
8649 |
+
}
|
8650 |
+
return false;
|
8651 |
+
}, this))
|
8652 |
+
.on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) {
|
8653 |
+
this.dehover_node(e.currentTarget);
|
8654 |
+
}, this));
|
8655 |
+
};
|
8656 |
+
this.teardown = function () {
|
8657 |
+
if(this.settings.wholerow) {
|
8658 |
+
this.element.find(".jstree-wholerow").remove();
|
8659 |
+
}
|
8660 |
+
parent.teardown.call(this);
|
8661 |
+
};
|
8662 |
+
this.redraw_node = function(obj, deep, callback, force_render) {
|
8663 |
+
obj = parent.redraw_node.apply(this, arguments);
|
8664 |
+
if(obj) {
|
8665 |
+
var tmp = div.cloneNode(true);
|
8666 |
+
//tmp.style.height = this._data.core.li_height + 'px';
|
8667 |
+
if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; }
|
8668 |
+
if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; }
|
8669 |
+
obj.insertBefore(tmp, obj.childNodes[0]);
|
8670 |
+
}
|
8671 |
+
return obj;
|
8672 |
+
};
|
8673 |
+
};
|
8674 |
+
// include the wholerow plugin by default
|
8675 |
+
// $.jstree.defaults.plugins.push("wholerow");
|
8676 |
+
if(window.customElements && Object && Object.create) {
|
8677 |
+
var proto = Object.create(HTMLElement.prototype);
|
8678 |
+
proto.createdCallback = function () {
|
8679 |
+
var c = { core : {}, plugins : [] }, i;
|
8680 |
+
for(i in $.jstree.plugins) {
|
8681 |
+
if($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) {
|
8682 |
+
c.plugins.push(i);
|
8683 |
+
if(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) {
|
8684 |
+
c[i] = JSON.parse(this.getAttribute(i));
|
8685 |
+
}
|
8686 |
+
}
|
8687 |
+
}
|
8688 |
+
for(i in $.jstree.defaults.core) {
|
8689 |
+
if($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) {
|
8690 |
+
c.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i);
|
8691 |
+
}
|
8692 |
+
}
|
8693 |
+
$(this).jstree(c);
|
8694 |
+
};
|
8695 |
+
// proto.attributeChangedCallback = function (name, previous, value) { };
|
8696 |
+
try {
|
8697 |
+
window.customElements.define("vakata-jstree", function() {}, { prototype: proto });
|
8698 |
+
} catch (ignore) { }
|
8699 |
+
}
|
8700 |
+
|
8701 |
+
}));
|
assets/js/jstree.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!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.10",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(e){}if(!i||!i.length)try{i=e("#"+t.replace(e.jstree.idregex,"\\$&"))}catch(e){}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");if(i&&i._model.data[t])return r=i,!1}),r},e.fn.jstree=function(r){var i="string"==typeof r,s=Array.prototype.slice.call(arguments,1),a=null;return!(!0===r&&!this.length)&&(this.each(function(){var n=e.jstree.reference(this),o=i&&n?n[r]:null;if(a=i&&o?o.apply(n,s):null,n||i||r!==t&&!e.isPlainObject(r)||e.jstree.create(this,r),(n&&!i||!0===r)&&(a=n||!1),null!==a&&a!==t)return!1}),null!==a&&a!==t?a:this)},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='presentation'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden pfolder-folder-close'></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(e){}e||this.element.empty(),this.teardown()},_create_prototype_node:function(){var e,t,r=d.createElement("LI");r.setAttribute("role","presentation"),(e=d.createElement("I")).className="jstree-icon jstree-ocl",e.setAttribute("role","presentation"),r.appendChild(e),(e=d.createElement("A")).className="jstree-anchor",e.setAttribute("href","#"),e.setAttribute("tabindex","-1"),e.setAttribute("role","treeitem"),(t=d.createElement("I")).className="pfolder-folder-close",t.setAttribute("role","presentation"),e.appendChild(t);var i=d.createElement("span");i.className="folder-checkbox",e.appendChild(i);var s=d.createElement("input");s.setAttribute("type","checkbox"),s.setAttribute("class","checkbox"),i.appendChild(s);var a=d.createElement("span");a.className="folder-actions",e.appendChild(a);var n=d.createElement("span");n.className="folder-inline-edit",a.appendChild(n);var o=d.createElement("i");o.className="pfolder-edit-folder",n.appendChild(o);var c=d.createElement("span");c.className="star-icon",a.appendChild(c);var l=d.createElement("i");l.className="pfolder-star",c.appendChild(l);var h=d.createElement("span");h.className="sticky-icon",a.appendChild(h);var _=d.createElement("i");_.className="pfolder-pin",h.appendChild(_);var u=d.createElement("span");return u.className="premio-folder-count",a.appendChild(u),r.appendChild(e),e=t=null,r},_kbevent_to_func:function(e){var t=[];if(e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),t.push({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:"-"}[e.which]||e.which),"shift-shift"===(t=t.sort().join("-").toLowerCase())||"ctrl-ctrl"===t||"alt-alt"===t)return null;var r,i,s=this.settings.core.keyboard;for(r in s)if(s.hasOwnProperty(r)&&("-"!==(i=r)&&"+"!==i&&(i=(i=i.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS")).split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),i===t))return s[r];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(e){}}}).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){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;this.settings.core.dblclick_toggle&&this.toggle_node(e.target)},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){"pfolder-edit-folder"!=t.target.className&&"checkbox"!=t.target.className&&(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(!1===r||!0===r)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;t<r;t++)i=i.concat(this._model.data[this._data.core.selected[t]].parents);for(t=0,r=(i=e.vakata.array_unique(i)).length;t<r;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).length>1){if(a.slice(n).each(e.proxy(function(r,i){if(0===e(i).text().toLowerCase().indexOf(t))return e(i).focus(),o=!0,!1},this)),o)return;if(a.slice(0,n).each(e.proxy(function(r,i){if(0===e(i).text().toLowerCase().indexOf(t))return e(i).focus(),o=!0,!1},this)),o)return}if(new RegExp("^"+s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(t)){if(a.slice(n+1).each(e.proxy(function(t,r){if(e(r).text().toLowerCase().charAt(0)===s)return e(r).focus(),o=!0,!1},this)),o)return;if(a.slice(0,n+1).each(e.proxy(function(t,r){if(e(r).text().toLowerCase().charAt(0)===s)return e(r).focus(),o=!0,!1},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){var i;t&&t.id&&(t=t.id),t instanceof e&&t.length&&t[0].id&&(t=t[0].id);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(e){return!1}},get_path:function(t,r,i){if(!(t=t.parents?t:this.get_node(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;s<a;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))[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)}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)}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))[0]===this.element[0]){for(i=this.get_container_ul()[0].lastChild;i&&0===i.offsetHeight;)i=this._previousSibling(i);return!!i&&e(i)}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)}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.className||-1===i.className.indexOf("jstree-node"))&&e(i)},get_parent:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.parent},get_children_dom:function(e){return(e=this.get_node(e,!0))[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):!(!e||!e.length)&&e.children(".jstree-children").children(".jstree-node")},is_parent:function(e){return(e=this.get_node(e))&&(!1===e.state.loaded||e.children.length>0)},is_loaded:function(e){return(e=this.get_node(e))&&e.state.loaded},is_loading:function(e){return(e=this.get_node(e))&&e.state&&e.state.loading},is_open:function(e){return(e=this.get_node(e))&&e.state.opened},is_closed:function(e){return(e=this.get_node(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)))return r&&r.call(this,t,!1),!1;if(t.state.loaded){for(t.state.loaded=!1,a=0,n=t.parents.length;a<n;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;i<s;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]).state.loading=!1,t.state.loaded=e,t.state.failed=!t.state.loaded;var i,s=this.get_node(t,!0),a=0,n=this._model.data,o=!1;for(a=0,i=t.children.length;a<i;a++)if(n[t.children[a]]&&!n[t.children[a]].state.hidden){o=!0;break}t.state.loaded&&s&&s.length&&(s.removeClass("jstree-closed jstree-open jstree-leaf"),o?"#"!==t.id&&s.addClass(t.state.opened?"jstree-open":"jstree-closed"):s.addClass("jstree-leaf")),s.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;s<a;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;s<a;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)))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;i<s;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){!1===i?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))&&-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)).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()))&&(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;a<n;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)).children=[],t.children_d=[],r.d&&"string"==typeof(r=r.d)&&(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,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&&!0===e.children&&(c.state.loaded=!1,c.children=[],c.children_d=[]),f[c.id]=c,s=0,a=c.children.length;s<a;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]);for(s in d={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:r,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},_)_.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;s<a;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&&!0===e.children&&(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;i<s;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;i<s;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())):void 0!==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;i<s;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;i<s;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;i<s;i++)(r=j(n[i],d,p.parents.concat()))&&(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;i<s;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}}if("undefined"!=typeof window&&void 0!==window.document)return a;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;s<n;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;s<n;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)).onmessage=e.proxy(function(e){l.call(this,e.data,!0);try{a.terminate(),a=null}catch(e){}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(e){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){if(!(r=e.trim(r)).length)return!0;h.li_attr[t]=r,"id"===t&&(h.id=r.toString())}),(d=r.children("a").first()).length&&(d=e.vakata.attributes(d,!0),e.each(d,function(t,r){(r=e.trim(r)).length&&(h.a_attr[t]=r)})),(d=r.children("a").first().length?r.children("a").first().clone():r.clone()).children("ins, i, ul").remove(),d=d.html(),d=e("<div></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")).length&&(h.icon=!d.hasClass("jstree-themeicon-hidden")&&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,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&&!0===e.children&&(h.state.loaded=!1,h.children=[],h.children_d=[]),c[h.id]=h,s=0,a=h.children.length;s<a;s++)o=c[n=this._parse_model_from_flat_json(c[h.children[s]],h.id,i)],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]);for(s in d={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:r,parents:i,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},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;s<a;s++)o=l[n=this._parse_model_from_json(e.children[s],d.id,i)],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&&!0===e.children&&(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;r<i;r++)(t=this.redraw_node(s[r],!0,this._model.force_full_redraw))&&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.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.length)return!1;if(t.children(".jstree-children").remove(),t=t[0],r.children.length&&r.state.loaded){for((a=n.createElement("UL")).setAttribute("role","group"),a.className="jstree-children",i=0,s=r.children.length;i<s;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])===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(!(null===(n=a.parent!==e.jstree.root?e("#"+a.parent.replace(e.jstree.idregex,"\\$&"),this.element)[0]:null)||n&&f[a.parent].state.opened))return!1;o=e.inArray(a.id,null===n?f[e.jstree.root].children:f[a.parent].children)}for(l in t=this._data.core.node.cloneNode(!0),u="jstree-node ",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.childNodes[1].setAttribute("aria-selected",!!a.state.selected),t.setAttribute("aria-level",a.parents.length),t.childNodes[1].setAttribute("aria-level",a.parents.length),t.setAttribute("aria-labelledby",a.a_attr.id),t.setAttribute("data-folder",a.id),a.state.disabled&&(t.setAttribute("aria-disabled",!0),t.childNodes[1].setAttribute("aria-disabled",!0)),l=0,h=a.children.length;l<h;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;l<h&&(f[f[a.parent].children[l]].state.hidden||(k=f[a.parent].children[l]),k===a.id);l++);for(h in 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),t.childNodes[1].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":""),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&&!0!==a.icon||!1===a.icon)&&(!1===a.icon?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;l<h;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;l<h;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")).setAttribute("role","group"),m.className="jstree-children",n.appendChild(m)),o<(n=m).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(a=0,n=(r=r.slice()).length;a<n;a++)this.open_node(r[a],i,s);return!0}return!(!(r=this.get_node(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-anchor").attr("aria-expanded",!0).end().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),o[0].childNodes[1].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)}):(i&&i.call(this,r,!1),!1))},_open_to:function(t){if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;var r,i,s=t.parents;for(r=0,i=s.length;r<i;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(s=0,a=(r=r.slice()).length;s<a;s++)this.close_node(r[s],i);return!0}return!(!(r=this.get_node(r))||r.id===e.jstree.root)&&(!this.is_closed(r)&&(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-anchor").attr("aria-expanded",!1).end().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.children(".jstree-anchor").attr("aria-expanded",!1),o.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:r})):this.trigger("after_close",{node:r}))))},toggle_node:function(t){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;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)))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;s<a;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")).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)))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;i<s;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.state&&e.state.disabled},enable_node:function(t){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.enable_node(t[r]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;t.state.disabled=!1,this.get_node(t,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),this.trigger("enable_node",{node:t})},disable_node:function(t){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.disable_node(t[r]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;t.state.disabled=!0,this.get_node(t,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),this.trigger("disable_node",{node:t})},is_hidden:function(e){return!0===(e=this.get_node(e)).state.hidden},hide_node:function(t,r){var i,s;if(e.isArray(t)){for(i=0,s=(t=t.slice()).length;i<s;i++)this.hide_node(t[i],!0);return r||this.redraw(),!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;t.state.hidden||(t.state.hidden=!0,this._node_changed(t.parent),r||this.redraw(),this.trigger("hide_node",{node:t}))},show_node:function(t,r){var i,s;if(e.isArray(t)){for(i=0,s=(t=t.slice()).length;i<s;i++)this.show_node(t[i],!0);return r||this.redraw(),!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;t.state.hidden&&(t.state.hidden=!1,this._node_changed(t.parent),r||this.redraw(),this.trigger("show_node",{node:t}))},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(void 0!==r.isTrigger&&r.isTrigger>0)return!1;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;i<s;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.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){if(!(e=this.get_node(e,!0))||!e.length||!e.children(".jstree-hovered").length)return!1;e.children(".jstree-anchor").removeClass("jstree-hovered"),this.trigger("dehover_node",{node:this.get_node(e)})},select_node:function(t,r,i,s){var a,n,o;if(e.isArray(t)){for(n=0,o=(t=t.slice()).length;n<o;n++)this.select_node(t[n],r,i,s);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;a=this.get_node(t,!0),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").attr("aria-selected",!0),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}))},deselect_node:function(t,r,i){var s,a,n;if(e.isArray(t)){for(s=0,a=(t=t.slice()).length;s<a;s++)this.deselect_node(t[s],r,i);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;n=this.get_node(t,!0),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").attr("aria-selected",!1),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}))},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;r<i;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;t<r;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").attr("aria-selected",!1).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.id===e.jstree.root)&&t.state.selected},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;r<i;r++)o[n[r].id]=n[r];for(r=0,i=n.length;r<i;r++)for(s=0,a=n[r].children_d.length;s<a;s++)o[n[r].children_d[s]]&&delete o[n[r].children_d[s]];for(r in n=[],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;r<i;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)}return!1},refresh:function(t,r){this._data.core.state=!0===r?{}: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='presentation' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden pfolder-folder-close'></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.id===e.jstree.root)return!1;var r=[],i=[],s=this._data.core.selected.concat([]);i.push(t.id),!0===t.state.opened&&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.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;i<s;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;i<s;i++)a[t.children[i]].parent=r;for(i=0,s=t.children_d.length;i<s;i++)a[t.children_d[i]].parents[e.inArray(t.id,a[t.children_d[i]].parents)]=r;return-1!==(i=e.inArray(t.id,this._data.core.selected))&&(this._data.core.selected[i]=r),(i=this.get_node(t.id,!0))&&(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.id===e.jstree.root)&&t.text},set_text:function(t,r){var i,s;if(e.isArray(t)){for(t=t.slice(),console.log(t),i=0,s=t.length;i<s;i++)this.set_text(t[i],r);return!0}return!(!(t=this.get_node(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)},get_json:function(t,r,i){if(!(t=this.get_node(t||e.jstree.root)))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)&&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;s<a;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)))return!1;if(!(s=s===t?"last":s).toString().match(/^(before|after)$/)&&!n&&!this.is_loaded(r))return this.load_node(r,function(){this.create_node(r,i,s,a,!0)});var o,d,c,l;switch(i||(i={text:this.get_string("New node")}),(i="string"==typeof i?{text:i}:e.extend(!0,{},i)).text===t&&(i.text=this.get_string("New node")),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(!0===i.id&&delete i.id,!(i=this._parse_model_from_json(i,r.id,r.parents.concat())))return!1;for(o=this.get_node(i),(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;c<l;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;c<l;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(i=0,s=(t=t.slice()).length;i<s;i++)this.rename_node(t[i],r);return!0}return!(!(t=this.get_node(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))},delete_node:function(t){var r,i,s,a,n,o,d,c,l,h,_,u;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.delete_node(t[r]);return!0}if(!(t=this.get_node(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([])).push(t.id),o=0,d=t.parents.length;o<d;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;c<l;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;c<l;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,par:!(!i||!i.id)&&i.id})},!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,par:!(!i||!i.id)&&i.id})},!1}return n&&n.data&&(n=n.data),n&&n.functions&&(!1===n.functions[t]||!0===n.functions[t])?(!1===n.functions[t]&&(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,par:!(!i||!i.id)&&i.id})}),n.functions[t]):!(!1===o||e.isFunction(o)&&!1===o.call(this,t,r,i,s,a)||o&&!1===o[t])||(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,par:!(!i||!i.id)&&i.id})},!1)},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;c<l;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.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,f=!(g=d||(this._model.data[r.id]?this:e.jstree.reference(r.id)))||!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);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(),-1!==(m=e.inArray(r.id,p))&&(p=e.vakata.array_remove(p,m),s>m&&s--),m=[],v=0,j=p.length;v<j;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()).push(r.id),v=0,j=r.parents.length;v<j;v++){for(p=[],y=0,k=(x=g._model.data[r.parents[v]].children_d).length;y<k;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;v<j;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;v<j;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()).unshift(u.id),x=r.parents.length,r.parents=m,m=m.concat(),v=0,j=r.children_d.length;v<j;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;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;c<l;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.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||(this._model.data[r.id]?this:e.jstree.reference(r.id)))||!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))return!1;if(!0===f.id&&delete f.id,!(f=this._parse_model_from_json(f,m.id,m.parents.concat())))return!1;for(_=this.get_node(f),r&&r.state&&!1===r.state.loaded&&(_.state.loaded=!1),(h=[]).push(f),h=h.concat(_.children_d),this.trigger("model",{nodes:h,parent:m.id}),u=0,g=m.parents.length;u<g;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;u<g;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;n<o;n++)(r=this.get_node(t[n]))&&r.id&&r.id!==e.jstree.root&&d.push(r);if(!d.length)return!1;i=d,a=this,s="move_node",this.trigger("cut",{node:t})},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;n<o;n++)(r=this.get_node(t[n]))&&r.id&&r.id!==e.jstree.root&&d.push(r);if(!d.length)return!1;i=d,a=this,s="copy_node",this.trigger("copy",{node:t})},get_buffer:function(){return{mode:s,node:i,inst:a}},can_paste:function(){return!1!==s&&!1!==i},paste:function(e,t){if(!((e=this.get_node(e))&&s&&s.match(/^(copy_node|move_node)$/)&&i))return!1;this[s](i,e,t,!1,!1,!1,a)&&this.trigger("paste",{parent:e.id,node:i,mode:s}),i=!1,s=!1,a=!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></span>"),c=r,l=e("<div></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").val(),d=this.settings.core.force_text;""===a&&(a=c),l.remove(),o.replaceWith(n),o.remove(),c=d?c:e("<div></div>").append(e.parseHTML(c)).html(),t=this.get_node(t),this.set_text(t,c),(s=!!this.rename_node(t,d?e("<div></div>").text(a).text():e("<div></div>").append(e.parseHTML(a)).html()))||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),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){if(13===e.which)return!1}}),_={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))},set_theme:function(t,r){if(!t)return!1;if(!0===r){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(s=0,a=(r=r.slice()).length;s<a;s++)this.set_icon(r[s],i);return!0}return!(!(r=this.get_node(r))||r.id===e.jstree.root)&&(o=r.icon,r.icon=!0===i||null===i||i===t||""===i||i,n=this.get_node(r,!0).children(".jstree-anchor").children(".jstree-themeicon"),!1===i?(n.removeClass("jstree-themeicon-custom "+o).css("background","").removeAttr("rel"),this.hide_icon(r)):!0===i||null===i||i===t||""===i?(n.removeClass("jstree-themeicon-custom "+o).css("background","").removeAttr("rel"),!1===o&&this.show_icon(r)):-1===i.indexOf("/")&&-1===i.indexOf(".")?(n.removeClass(o).css("background",""),n.addClass(i+" jstree-themeicon-custom").attr("rel",i),!1===o&&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),!1===o&&this.show_icon(r)),!0)},get_icon:function(t){return!(!(t=this.get_node(t))||t.id===e.jstree.root)&&t.icon},hide_icon:function(t){var r,i;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.hide_icon(t[r]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root)&&(t.icon=!1,this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0)},show_icon:function(t){var r,i,s;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.show_icon(t[r]);return!0}return!(!(t=this.get_node(t))||t===e.jstree.root)&&(s=this.get_node(t,!0),t.icon=!s.length||s.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"),t.icon||(t.icon=!0),s.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0)}},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;r<i;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);for(s in i=[],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;s<a;s++)n[r[s]]=1;for(s=0,a=i.selected.length;s<a;s++)n[i.selected[s]]?n[i.selected[s]]=2:i.changed.selected.push(i.selected[s]);for(s=0,a=r.length;s<a;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,_,u=d.createElement("I");u.className="jstree-icon jstree-checkbox",u.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;r<i;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;s<a;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;s<a;s++)if(c[h[s]].state[g?"selected":"checked"]){for(n=0,o=c[h[s]].children_d.length;n<o;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;s<a;s++)c[l.children_d[s]].children.length||_.push(c[l.children_d[s]].parent);for(n=0,o=(_=e.vakata.array_unique(_)).length;n<o;n++)for(l=c[_[n]];l&&l.id!==e.jstree.root;){for(i=0,s=0,a=l.children.length;s<a;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.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;i<s;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;i<s;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;i<s;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.length&&n.attr("aria-selected",!0).children(".jstree-anchor").addClass(h?"jstree-clicked":"jstree-checked"),c=this.get_node(c.parent)}for(i in u=[],_)_.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;i<s;i++)(a=o[n.children_d[i]])&&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;i<s;i++)(a=this._model.data[n.parents[i]]).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.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;i<s;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.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;a<n;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.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;a<n;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.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.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;i<s;i++)if(d[l[i]]&&d[l[i]].parents)for(a=0,n=d[l[i]].parents.length;a<n&&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;i<s;i++)if(!(r=d[c.children_d[i]]).state.loaded&&r.original&&r.original.state&&r.original.state.undetermined&&!0===r.original.state.undetermined)for(o[r.id]===t&&r.id!==e.jstree.root&&(o[r.id]=!0,h.push(r.id)),a=0,n=r.parents.length;a<n;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&&!0===c.original.state.undetermined)for(o[c.id]===t&&c.id!==e.jstree.root&&(o[c.id]=!0,h.push(c.id)),a=0,n=c.parents.length;a<n;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;i<s;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;e<t;e++)(r=this.get_node(i[e],!0))&&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;n<o;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=u.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||!0===t.state[a?"selected":"checked"]||-1===s.indexOf("undetermined")||-1===s.indexOf("down")&&-1===s.indexOf("up"))return!1;if(!t.state.loaded&&!0===t.original.state.undetermined)return!0;for(r=0,i=t.children_d.length;r<i;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(r=0,i=(t=t.slice()).length;r<i;r++)this.disable_checkbox(t[r]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;s=this.get_node(t,!0),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}))},this.enable_checkbox=function(t){var r,i,s;if(e.isArray(t)){for(r=0,i=(t=t.slice()).length;r<i;r++)this.enable_checkbox(t[r]);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;s=this.get_node(t,!0),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}))},this.activate_node=function(t,r){return!e(r.target).hasClass("jstree-checkbox-disabled")&&(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)&&(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.settings.checkbox.tie_selection,n=this._model.data[e],o=[],d=[];if(!this.settings.checkbox.cascade_to_disabled&&n.state.disabled||!this.settings.checkbox.cascade_to_hidden&&n.state.hidden)s=this.get_checked_descendants(e),n.state[a?"selected":"checked"]&&s.push(n.id),o=o.concat(s);else{if(n.children)for(r=0,i=n.children.length;r<i;r++){var c=n.children[r];s=this._cascade_new_checked_state(c,t),o=o.concat(s),s.indexOf(c)>-1&&d.push(c)}var l=this.get_node(n,!0),h=d.length>0&&d.length<n.children.length;n.original&&n.original.state&&n.original.state.undetermined&&(n.original.state.undetermined=h),h?(n.state[a?"selected":"checked"]=!1,l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(a?"jstree-clicked":"jstree-checked")):t&&d.length===n.children.length?(n.state[a?"selected":"checked"]=t,o.push(n.id),l.attr("aria-selected",!0).children(".jstree-anchor").addClass(a?"jstree-clicked":"jstree-checked")):(n.state[a?"selected":"checked"]=!1,l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(a?"jstree-clicked":"jstree-checked"))}return o},this.get_checked_descendants=function(t){var r=this,i=r.settings.checkbox.tie_selection,s=r._model.data[t];return e.vakata.array_filter(s.children_d,function(e){return r._model.data[e].state[i?"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(s=0,a=(t=t.slice()).length;s<a;s++)this.check_node(t[s],r);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;i=this.get_node(t,!0),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}))},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(i=0,s=(t=t.slice()).length;i<s;i++)this.uncheck_node(t[i],r);return!0}if(!(t=this.get_node(t))||t.id===e.jstree.root)return!1;a=this.get_node(t,!0),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}))},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;t<r;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;e<t;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.id===e.jstree.root)&&t.state.checked},this.get_checked=function(t){return this.settings.checkbox.tie_selection?this.get_selected(t):t?e.map(this._data.checkbox.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.checkbox.selected.slice()},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;r<i;r++)o[n[r].id]=n[r];for(r=0,i=n.length;r<i;r++)for(s=0,a=n[r].children_d.length;s<a;s++)o[n[r].children_d[s]]&&delete o[n[r].children_d[s]];for(r in n=[],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;r<i;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;if(!e.isArray(t)&&!this.settings.checkbox.tie_selection&&(n=this.get_node(t))&&n.state.loaded)for(s=0,a=n.children_d.length;s<a;s++)this._model.data[n.children_d[s]].state.checked&&(!0,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,n.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){if(this.settings.conditionalselect.call(this,this.get_node(e),r))return t.activate_node.call(this,e,r)}},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.id===e.jstree.root)return!1;var n=this.settings.contextmenu,o=this.get_node(r,!0).children(".jstree-anchor"),d=!1,c=!1;(n.show_at_node||i===t||s===t)&&(d=o.offset(),i=d.left,s=d.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(r)&&this.activate_node(r,a),c=n.items,e.isFunction(c)&&(c=c.call(this,r,e.proxy(function(e){this._show_contextmenu(r,i,s,e)},this))),e.isPlainObject(c)&&this._show_contextmenu(r,i,s,c)},this._show_contextmenu=function(t,r,i,s){var a=this.get_node(t,!0).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),a.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,e.vakata.context.show(a,{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._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}})},_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){if(!i)return!0;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||"")+(!0===i._disabled||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&&(-1!==i.icon.indexOf("/")||-1!==i.icon.indexOf(".")?a+=" style='background:url(\""+i.icon+"\") center center no-repeat' ":a+=" 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))&&(a+=s),a+="</li>",i.separator_after&&(a+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+"> </a></li>",n=!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},_show_submenu:function(r){if((r=e(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")?s<o&&i.css("margin-right",s-o):c-a<o&&i.css("margin-left",c-a-o),i.show()}},show:function(i,s,a){var n,o,c,l,h,_,u,g;switch(r.element&&r.element.length&&r.element.width(""),!0){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())<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(){e.vakata.context.hide()},e.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(t){t.preventDefault(),e(this).blur().parent().hasClass("vakata-context-disabled")||!1===e.vakata.context._execute(e(this).attr("rel"))||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()).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()).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},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)&&(!0===this.settings.dnd.is_draggable||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,i>1?this.get_top_selected(!0):[r],t))){if(h={jstree:!0,origin:this,obj:this.get_node(r,!0),nodes:i>1?this.get_top_selected():[r.id]},_=t.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,h,'<div id="jstree-dnd" data-txt="'+s+'" class="jstree-'+this.get_theme()+" jstree-"+this.get_theme()+"-"+this.get_theme_variant()+" "+(this.settings.core.themes.responsive?" jstree-dnd-responsive":"")+'">'+s+"</div>");e.vakata.dnd._trigger("start",t,{helper:e(),element:_,data:h})}},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:_,data:h}),!1}).on("drop.jstree",e.proxy(function(t){return t.preventDefault(),e.vakata.dnd._trigger("stop",t,{helper:e(),element:_,data:h}),!1},this))},this.redraw_node=function(e,t,i,s){if((e=r.redraw_node.apply(this,arguments))&&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;a<n;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){_&&e.vakata.dnd._trigger("move",t,{helper:e(),element:_,data:h})}).on("drop.vakata.jstree",function(t){_&&(e.vakata.dnd._trigger("stop",t,{helper:e(),element:_,data:h}),_=null,h=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,N,A=e.jstree.reference(d.event.target),T=!1,O=!1,S=!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.length&&T.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(O=T.offset(),S=(d.event.pageY!==t?d.event.pageY:d.event.originalEvent.pageY)-O.top,_=T.outerHeight(),f=S<_/3?["b","i","a"]:S>_-_/3?["a","i","b"]:S>_/2?["i","a","b"]:["i","b","a"],e.each(f,function(t,s){switch(s){case"b":l=O.left-6,h=O.top,u=A.get_parent(T),g=T.parent().index(),N="jstree-below";break;case"i":x=A.settings.dnd.inside_pos,b=A.get_node(T.parent()),l=O.left-2,h=O.top+_/2+1,u=b.id,g="first"===x?0:"last"===x?b.children.length:Math.min(x,b.children.length),N="jstree-inside";break;case"a":l=O.left-6,h=O.top+_,u=A.get_parent(T),g=T.parent().index()+1,N="jstree-above"}for(p=!0,m=0,v=d.data.nodes.length;m<v;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&&!1===A.settings.dnd.check_while_dragging||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})))){A&&A.last_error&&(i=A.last_error());break}var o,S;if("i"===s&&T.parent().is(".jstree-closed")&&A.settings.dnd.open_timeout&&(d.event&&"dragover"===d.event.type&&!c||(a&&clearTimeout(a),a=setTimeout((o=A,S=T,function(){o.open_node(S)}),A.settings.dnd.open_timeout))),p)return(C=A.get_node(u,!0)).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(),n.removeClass("jstree-above jstree-inside jstree-below").addClass(N),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}),!0===f))return}else{for(p=!0,m=0,v=d.data.nodes.length;m<v&&(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}));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;d<c;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")).length&&i&&i.error&&"check"===i.error&&(d=d.jstree(!0))&&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.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></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},_=null,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(!0===t)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(e){}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,!1!==s&&(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();if(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)return r.scroll_e=e(this),!1}),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=[],h=this._model.data;if(!s){for(n=0,o=t.length;n<o;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.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;n<o;n++)(d=this.get_node(t[n],!0))&&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;c<l;c++)(d=this.get_node(t[c],!0))&&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.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;i<s;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;a<n;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(!1===r||""===e.trim(r.toString()))return this.clear_search();a=(a=this.get_node(a))&&a.id?a.id:null,r=r.toString();var d,c,l=this.settings.search,h=!!l.ajax&&l.ajax,_=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&&!1!==h)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)).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||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(d=0,c=(f=e.vakata.array_unique(f)).length;d<c;d++)f[d]!==e.jstree.root&&_[f[d]]&&!0===this.open_node(f[d],null,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))&&-1!==e.inArray(t.id,this._data.search.res)){var n,o,d=null;for(n=0,o=t.childNodes.length;n<o;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||{},!1!==(i=e.extend({},e.vakata.search.defaults,i)).fuzzy&&(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;r<h;r++)e[t.charAt(r)]=0;for(r=0;r<h;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),-1!==(y=e.lastIndexOf(t,d+h))&&(j=Math.min(n(0,y),j))),y=-1,r=0;r<h;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))[f+1]=(1<<r)-1,o=f;o>=g;o--)if(m=a[e.charAt(o-1)],p[o]=0===r?(p[o+1]<<1|1)&m:(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){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}},!0===r?{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.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),r))for(i=0,s=t.children_d.length;i<s;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(e){return!1}return!(t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl)&&(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))},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;s<a;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,!0===o[d[s]].icon&&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(!1===c)return!1;if(e.isArray(c))for(a=0,n=c.length;a<n;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;r<i;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(!1===i.check.call(this,r,s,a,n,o))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)).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,par:!(!a||!a.id)&&a.id})},!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,par:!(!a||!a.id)&&a.id})},!1;if(_&&s.children_d&&s.parents){for(c=0,l=0,h=s.children_d.length;l<h;l++)c=Math.max(c,_[s.children_d[l]].parents.length);c=c-s.parents.length+1}(c<=0||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,par:!(!a||!a.id)&&a.id})},!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)))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))&&(r?e.extend({type:t.type},this.settings.types[t.type]):t.type)},this.set_type=function(r,i){var s,a,n,o,d,c,l,h,_=this._model.data;if(e.isArray(r)){for(a=0,n=(r=r.slice()).length;a<n;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.length&&(h=l.children(".jstree-anchor")),o=r.type,d=this.get_icon(r),r.type=i,(!0===d||!s[o]||s[o].icon!==t&&d===s[o].icon)&&this.set_icon(r,s[i].icon===t||s[i].icon),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(!1===i.check.call(this,t,r,s,a,n))return!1;if(r=r&&r.id?r:this.get_node(r),!(s=s&&s.id?s:this.get_node(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;o<d;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)||(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,par:!(!s||!s.id)&&s.id})}),o;case"create_node":return(o=-1===e.inArray(l,h))||(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,par:!(!s||!s.id)&&s.id})}),o;case"copy_node":return(o=-1===e.inArray(l,h))||(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,par:!(!s||!s.id)&&s.id})}),o;case"move_node":return(o=r.parent===s.id&&(!n||!n.is_multi)||-1===e.inArray(l,h))||(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,par:!(!s||!s.id)&&s.id})}),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)))return i.create_node.call(this,r,s,a,n,o);if(!(a=a===t?"last":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);)u=c=m.call(this,d,++h).toString(),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;r<i;r++)(s=this.get_node(t.selected[r],!0))&&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(e){}}}});
|
assets/js/page-post-media.js
CHANGED
@@ -1,5 +1,17 @@
|
|
1 |
-
(function(
|
2 |
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
var selectedFolderMediaId = -1;
|
4 |
var defaultFolderHtml;
|
5 |
var folderID = 0;
|
@@ -22,6 +34,18 @@
|
|
22 |
var lastOrderStatus = "";
|
23 |
var ajaxURL = "";
|
24 |
var folderOrder = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
var MediaLibraryOrganizerTaxonomyFilter = wp.media.view.AttachmentFilters.extend({
|
26 |
id: 'media-attachment-taxonomy-filter',
|
27 |
createFilters: function() {
|
@@ -83,8 +107,6 @@
|
|
83 |
}
|
84 |
});
|
85 |
|
86 |
-
|
87 |
-
var selectedFolderMediaId = -1;
|
88 |
var selectedFolderPageID = "all";
|
89 |
var filesInQueue = 0;
|
90 |
var uploadedFileCount = 0;
|
@@ -165,9 +187,9 @@
|
|
165 |
});
|
166 |
}
|
167 |
|
168 |
-
if(
|
169 |
-
if(
|
170 |
-
|
171 |
}
|
172 |
}
|
173 |
}
|
@@ -244,21 +266,21 @@
|
|
244 |
}, open: function () {
|
245 |
$(".folder-modal").removeClass("folder-modal");
|
246 |
if (windowModal.prototype.open.apply(this, arguments)) {
|
247 |
-
console.log("media frame open");
|
248 |
if($(".folder-modal").length) {
|
249 |
$(".folder-custom-menu").remove();
|
250 |
$(".folder-modal .media-frame-tab-panel").removeClass("has-folder-menu");
|
251 |
if($(".folder-modal .media-frame").hasClass("hide-menu")) {
|
252 |
if (!$(".folder-custom-menu").length) {
|
253 |
-
$(".folder-modal .media-frame-tab-panel").before("<div class='folder-custom-menu'><div class='folder-menu-content'></div></div>");
|
254 |
$(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url + " #wcp-content-resize", function () {
|
255 |
checkForExpandCollapse();
|
|
|
256 |
});
|
257 |
}
|
258 |
} else {
|
259 |
if (!$(".folder-custom-menu").length) {
|
260 |
$(".folder-modal .media-frame-menu").addClass("has-folder-menu");
|
261 |
-
$(".folder-modal .media-frame-menu .media-menu").append("<div class='folder-custom-menu'><div class='folder-menu-content'></div></div>");
|
262 |
$(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url + " #wcp-content-resize", function () {
|
263 |
checkForExpandCollapse();
|
264 |
});
|
@@ -268,13 +290,22 @@
|
|
268 |
$(".folder-form-data").remove();
|
269 |
$(".media-frame-tab-panel:first").before("<div class='folder-form-data'></div>");
|
270 |
$(".folder-form-data").load(folders_media_options.media_page_url+ " #folder-add-update-content", function(){ });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
}
|
272 |
}
|
273 |
}, close: function () {
|
274 |
windowModal.prototype.close.apply(this, arguments);
|
275 |
$(".folder-modal").removeClass("folder-modal");
|
276 |
}
|
277 |
-
})
|
278 |
// wpMedia.media.view.Modal.prototype.on('open', function() {
|
279 |
// $(".folder-custom-menu").remove();
|
280 |
// if(!$(".folder-custom-menu").length) {
|
@@ -301,8 +332,11 @@
|
|
301 |
$(document).on("click", ".header-posts a.all-posts", function(e){
|
302 |
fileFolderID = 0;
|
303 |
activeRecordID = "";
|
|
|
304 |
$(".active-item").removeClass("active-item");
|
|
|
305 |
$(this).addClass("active-item");
|
|
|
306 |
$(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("all").trigger("change");
|
307 |
$(this).closest(".media-frame").find(".folder_for_media").val("all").trigger("change");
|
308 |
});
|
@@ -310,19 +344,25 @@
|
|
310 |
$(document).on("click", ".un-categorised-items", function(e){
|
311 |
fileFolderID = 0;
|
312 |
activeRecordID = "";
|
|
|
313 |
$(".active-item").removeClass("active-item");
|
|
|
|
|
314 |
$(this).addClass("active-item");
|
315 |
$(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("unassigned").trigger("change");
|
316 |
$(this).closest(".media-frame").find(".folder_for_media").val("-1").trigger("change");
|
317 |
});
|
318 |
|
319 |
-
$(document).on("click", "
|
320 |
-
|
321 |
-
|
|
|
322 |
$(".active-item").removeClass("active-item");
|
323 |
-
$(
|
324 |
-
$(
|
325 |
-
|
|
|
|
|
326 |
});
|
327 |
|
328 |
$(document).on("change", ".folder_for_media", function(){
|
@@ -335,27 +375,31 @@
|
|
335 |
|
336 |
/* right click menu */
|
337 |
$(document).on("click", ".update-inline-record", function(e){
|
|
|
338 |
e.stopPropagation();
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
340 |
$(".dynamic-menu").remove();
|
341 |
$(".active-menu").removeClass("active-menu");
|
342 |
-
|
343 |
"<li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li>" +
|
344 |
"<li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li>" +
|
345 |
"<li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li>" +
|
346 |
-
"<li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>" + ((isHigh) ? " Remove Star" : "Add a Star") + "</a></li>"
|
347 |
"<li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";
|
348 |
|
349 |
-
|
350 |
-
if(folders_media_options.post_type == "attachment" && hasPosts) {
|
351 |
menuHtml += "<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>";
|
352 |
}
|
353 |
menuHtml += "<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li>" +
|
354 |
"</ul></div>";
|
355 |
-
$(this).closest("
|
356 |
-
$(this).
|
357 |
-
|
358 |
-
if(($(this).closest("h3.title").offset().top + $(".dynamic-menu").height()) > ($(window).height() - 20)) {
|
359 |
$(".dynamic-menu").addClass("bottom-fix");
|
360 |
|
361 |
if($(".dynamic-menu.bottom-fix").offset().top < $("#custom-scroll-menu").offset().top) {
|
@@ -369,34 +413,43 @@
|
|
369 |
$(".active-menu").removeClass("active-menu");
|
370 |
$(".folder-order").removeClass("active");
|
371 |
});
|
|
|
372 |
$(document).on("click", ".dynamic-menu, .folder-order", function(e){
|
373 |
e.stopPropagation();
|
374 |
});
|
375 |
|
376 |
-
$(document).on("contextmenu", "
|
377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
if(folders_media_options.can_manage_folder == 0) {
|
379 |
-
return
|
380 |
}
|
381 |
-
|
|
|
|
|
382 |
$(".dynamic-menu").remove();
|
383 |
$(".active-menu").removeClass("active-menu");
|
384 |
-
|
385 |
"<li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li>" +
|
386 |
"<li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li>" +
|
387 |
"<li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li>" +
|
388 |
"<li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>" + ((isHigh) ? " Remove Star" : "Add a Star") + "</a></li>"+
|
389 |
"<li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";
|
390 |
|
391 |
-
|
392 |
-
|
393 |
-
if(folders_media_options.post_type == "attachment" && hasPosts) {
|
394 |
menuHtml += "<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>";
|
395 |
}
|
396 |
menuHtml += "<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li>" +
|
397 |
"</ul></div>";
|
398 |
-
$(this).after(menuHtml);
|
399 |
-
$(this).parents("li.
|
400 |
if(($(this).offset().top + $(".dynamic-menu").height()) > ($(window).height() - 20)) {
|
401 |
$(".dynamic-menu").addClass("bottom-fix");
|
402 |
|
@@ -404,15 +457,25 @@
|
|
404 |
$(".dynamic-menu").removeClass("bottom-fix");
|
405 |
}
|
406 |
}
|
407 |
-
return false;
|
408 |
});
|
409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
|
411 |
/* add new folder functionality */
|
412 |
$(document).on("click", ".new-folder", function(e) {
|
413 |
e.stopPropagation();
|
414 |
-
$(
|
415 |
-
|
|
|
|
|
|
|
416 |
$(".dynamic-menu").remove();
|
417 |
$(".active-menu").removeClass("active-menu");
|
418 |
isItFromMedia = false;
|
@@ -443,20 +506,34 @@
|
|
443 |
$("#save-folder-data").html('<span class="dashicons dashicons-update"></span>');
|
444 |
$("#add-update-folder").addClass("disabled");
|
445 |
|
446 |
-
var
|
447 |
if(isItFromMedia) {
|
448 |
-
|
449 |
}
|
450 |
|
451 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
url: folders_media_options.ajax_url,
|
453 |
-
data:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
method: 'post',
|
455 |
success: function (res) {
|
456 |
-
|
457 |
if (result.status == '1') {
|
458 |
-
$("#space_" + result.parent_id).append(result.term_data);
|
459 |
-
$("#wcp_folder_" + result.parent_id).addClass("active has-sub-tree");
|
460 |
isKeyActive = parseInt(result.is_key_active);
|
461 |
n_o_file = parseInt(result.folders);
|
462 |
$("#current-folder").text(n_o_file);
|
@@ -464,9 +541,26 @@
|
|
464 |
checkForExpandCollapse();
|
465 |
$(".folder-popup-form").hide();
|
466 |
$(".folder-popup-form").removeClass("disabled");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
ajaxAnimation();
|
468 |
-
|
469 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
} else {
|
471 |
$(".folder-popup-form").hide();
|
472 |
$(".folder-popup-form").removeClass("disabled");
|
@@ -482,9 +576,11 @@
|
|
482 |
$(document).on("click", ".form-cancel-btn", function(){
|
483 |
$(".folder-popup-form").hide();
|
484 |
});
|
|
|
485 |
$(document).on("click", ".folder-popup-form", function (e) {
|
486 |
$(".folder-popup-form").hide();
|
487 |
});
|
|
|
488 |
$(document).on("click", ".popup-form-content", function (e) {
|
489 |
e.stopPropagation();
|
490 |
});
|
@@ -503,15 +599,22 @@
|
|
503 |
};
|
504 |
|
505 |
/* Update folder */
|
506 |
-
$(
|
507 |
-
|
508 |
-
|
509 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
});
|
511 |
|
512 |
$(document).on("click", "#inline-update", function (e) {
|
513 |
-
if($("#
|
514 |
-
fileFolderID = $("#
|
515 |
updateFolder();
|
516 |
}
|
517 |
});
|
@@ -519,7 +622,7 @@
|
|
519 |
$(document).on("submit", "#update-folder-form", function(e){
|
520 |
e.stopPropagation();
|
521 |
e.preventDefault();
|
522 |
-
|
523 |
folderNameDynamic = $("#update-folder-item-name").val();
|
524 |
|
525 |
if($.trim(folderNameDynamic) == "") {
|
@@ -529,24 +632,39 @@
|
|
529 |
$("#update-folder-data").html('<span class="dashicons dashicons-update"></span>');
|
530 |
$("#update-folder-item").addClass("disabled");
|
531 |
|
532 |
-
nonce =
|
533 |
-
|
534 |
if (parentID == undefined) {
|
535 |
parentID = 0;
|
536 |
}
|
537 |
-
|
538 |
url: folders_media_options.ajax_url,
|
539 |
-
data:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
540 |
method: 'post',
|
541 |
success: function (res) {
|
542 |
-
|
543 |
if (result.status == '1') {
|
544 |
-
$("#
|
545 |
-
|
|
|
|
|
|
|
|
|
|
|
546 |
$(".folder-popup-form").hide();
|
547 |
$(".folder-popup-form").removeClass("disabled");
|
548 |
ajaxAnimation();
|
549 |
-
|
|
|
|
|
550 |
} else {
|
551 |
$(".folder-popup-form").hide();
|
552 |
$(".folder-popup-form").removeClass("disabled");
|
@@ -560,86 +678,113 @@
|
|
560 |
});
|
561 |
|
562 |
/* Mark Folder */
|
563 |
-
$(
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
} else {
|
582 |
-
$("
|
|
|
|
|
|
|
583 |
}
|
584 |
-
ajaxAnimation();
|
585 |
-
} else {
|
586 |
-
$(".folder-popup-form").hide();
|
587 |
-
$(".folder-popup-form").removeClass("disabled");
|
588 |
-
$("#error-folder-popup-message").html(res.message);
|
589 |
-
$("#error-folder-popup").show();
|
590 |
}
|
591 |
-
}
|
592 |
});
|
593 |
});
|
594 |
|
595 |
/* Duplicate Folder */
|
596 |
-
$(
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
});
|
604 |
|
605 |
/* Remove folder */
|
606 |
-
$(
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
612 |
});
|
613 |
-
|
614 |
$(document).on("click", "#remove-folder-item", function (e){
|
615 |
e.stopPropagation();
|
616 |
$(".folder-popup-form").addClass("disabled");
|
617 |
$("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>');
|
618 |
-
nonce =
|
619 |
if(isMultipleRemove) {
|
620 |
removeMultipleFolderItems();
|
621 |
} else {
|
622 |
-
|
623 |
url: folders_media_options.ajax_url,
|
624 |
data: "type=" + folders_media_options.post_type + "&action=wcp_remove_folder&term_id=" + fileFolderID + "&nonce=" + nonce,
|
625 |
method: 'post',
|
626 |
success: function (res) {
|
627 |
-
|
628 |
if (res.status == '1') {
|
629 |
-
$(
|
630 |
-
$("#folder_" + fileFolderID).remove();
|
631 |
isKeyActive = parseInt(res.is_key_active);
|
632 |
n_o_file = parseInt(res.folders);
|
633 |
$("#current-folder").text(n_o_file);
|
634 |
$("#ttl-fldr").text((3*3)+(4/(2*2)));
|
|
|
635 |
ajaxAnimation();
|
636 |
$(".folder-popup-form").hide();
|
637 |
$(".folder-popup-form").removeClass("disabled");
|
638 |
-
|
|
|
639 |
if (activeRecordID == fileFolderID) {
|
640 |
-
|
641 |
}
|
642 |
-
resetDDCounter();
|
643 |
} else {
|
644 |
$(".folder-popup-form").hide();
|
645 |
$(".folder-popup-form").removeClass("disabled");
|
@@ -661,18 +806,18 @@
|
|
661 |
var statusType = 0;
|
662 |
if($(this).hasClass("all-open")) {
|
663 |
$(this).removeClass("all-open");
|
664 |
-
$(".has-sub-tree").removeClass("active");
|
665 |
statusType = 0;
|
666 |
$(this).attr("data-folder-tooltip","Expand");
|
|
|
667 |
} else {
|
668 |
$(this).addClass("all-open");
|
669 |
statusType = 1;
|
670 |
-
$(".has-sub-tree").addClass("active");
|
671 |
$(this).attr("data-folder-tooltip","Collapse");
|
|
|
672 |
}
|
673 |
folderIDs = "";
|
674 |
-
$(".
|
675 |
-
folderIDs += $(this).
|
676 |
});
|
677 |
if(folderIDs != "") {
|
678 |
$(".form-loader-count").css("width","100%");
|
@@ -709,121 +854,40 @@
|
|
709 |
success: function (res) {
|
710 |
res = jQuery.parseJSON(res);
|
711 |
if(res.status == 1) {
|
712 |
-
$("#
|
|
|
|
|
|
|
713 |
}
|
714 |
$(".form-loader-count").css("width", "0");
|
715 |
}
|
716 |
});
|
717 |
});
|
718 |
-
|
719 |
-
$('.space').livequery(function(){
|
720 |
-
$(this).sortable({
|
721 |
-
placeholder: "ui-state-highlight",
|
722 |
-
connectWith:'.space',
|
723 |
-
tolerance:'intersect',
|
724 |
-
over:function(event,ui){
|
725 |
-
|
726 |
-
},
|
727 |
-
update: function( event, ui ) {
|
728 |
-
var thisId = ui.item.context.attributes['data-folder-id'].nodeValue;
|
729 |
-
var orderString = "";
|
730 |
-
$(this).children().each(function(){
|
731 |
-
if($(this).hasClass("route")) {
|
732 |
-
orderString += $(this).data("folder-id")+",";
|
733 |
-
}
|
734 |
-
});
|
735 |
-
if(orderString != "") {
|
736 |
-
$(".form-loader-count").css("width","100%");
|
737 |
-
jQuery.ajax({
|
738 |
-
url: folders_media_options.ajax_url,
|
739 |
-
data: "term_ids=" + orderString + "&action=wcp_save_folder_order&type=" + folders_media_options.post_type+"&nonce="+folders_media_options.nonce,
|
740 |
-
method: 'post',
|
741 |
-
success: function (res) {
|
742 |
-
res = jQuery.parseJSON(res);
|
743 |
-
if (res.status == '1') {
|
744 |
-
$("#wcp_folder_parent").html(res.options);
|
745 |
-
$(".form-loader-count").css("width", "0");
|
746 |
-
resetMediaAndPosts();
|
747 |
-
ajaxAnimation();
|
748 |
-
} else {
|
749 |
-
$(".folder-popup-form").hide();
|
750 |
-
$(".folder-popup-form").removeClass("disabled");
|
751 |
-
$("#error-folder-popup-message").html(res.message);
|
752 |
-
$("#error-folder-popup").show();
|
753 |
-
window.location.reload(true);
|
754 |
-
}
|
755 |
-
}
|
756 |
-
});
|
757 |
-
}
|
758 |
-
},
|
759 |
-
receive: function (event, ui) {
|
760 |
-
calcWidth($(this).siblings('.title'));
|
761 |
-
$(this).closest("li.route").addClass("active");
|
762 |
-
$(this).closest("li.route").find("ul.ui-sortable:first-child > li").slideDown();
|
763 |
-
var parentId = $(this).closest("li.route").data("folder-id");
|
764 |
-
var thisId = ui.item.context.attributes['data-folder-id'].nodeValue;
|
765 |
-
if(parentId == undefined) {
|
766 |
-
parentId = 0;
|
767 |
-
}
|
768 |
-
var orderString = "";
|
769 |
-
if($("#wcp_folder_"+parentId+" .ui-sortable li").length) {
|
770 |
-
$("#wcp_folder_"+parentId+" .ui-sortable li").each(function(){
|
771 |
-
orderString += $(this).data("folder-id")+",";
|
772 |
-
});
|
773 |
-
} else if(parentId == 0) {
|
774 |
-
$("#custom-menu > ul.space > li").each(function(){
|
775 |
-
orderString += $(this).data("folder-id")+",";
|
776 |
-
});
|
777 |
-
}
|
778 |
-
$(".form-loader-count").css("width","100%");
|
779 |
-
nonce = $.trim($("#wcp_folder_"+thisId).data("nonce"));
|
780 |
-
jQuery.ajax({
|
781 |
-
url: folders_media_options.ajax_url,
|
782 |
-
data: "term_id=" + thisId + "&action=wcp_update_parent_information&parent_id=" + parentId+"&type=" + folders_media_options.post_type+"&nonce="+nonce,
|
783 |
-
method: 'post',
|
784 |
-
success: function (res) {
|
785 |
-
$(".form-loader-count").css("width","0%");
|
786 |
-
res = jQuery.parseJSON(res);
|
787 |
-
if(res.status == 0) {
|
788 |
-
$(".folder-popup-form").hide();
|
789 |
-
$(".folder-popup-form").removeClass("disabled");
|
790 |
-
$("#error-folder-popup-message").html(res.message);
|
791 |
-
$("#error-folder-popup").show();
|
792 |
-
} else {
|
793 |
-
ajaxAnimation();
|
794 |
-
}
|
795 |
-
}
|
796 |
-
});
|
797 |
-
}
|
798 |
-
});
|
799 |
-
$(this).disableSelection();
|
800 |
-
});
|
801 |
|
802 |
-
$("
|
803 |
$(this).droppable({
|
804 |
-
accept: ".wcp-move-file, .wcp-move-multiple, .
|
805 |
hoverClass: 'wcp-drop-hover',
|
806 |
classes: {
|
807 |
"ui-droppable-active": "ui-state-highlight"
|
808 |
},
|
809 |
drop: function( event, ui ) {
|
810 |
-
folderID = $(this).closest("li.
|
811 |
-
if ( ui.draggable.hasClass( 'wcp-move-multiple'
|
812 |
if($(".wp-list-table input:checked").length) {
|
813 |
-
|
814 |
$(".wp-list-table input:checked").each(function(){
|
815 |
chkStr += $(this).val()+",";
|
816 |
});
|
817 |
-
nonce =
|
818 |
-
|
819 |
url: folders_media_options.ajax_url,
|
820 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
821 |
method: 'post',
|
822 |
success: function (res) {
|
823 |
-
res =
|
824 |
if(res.status == "1") {
|
825 |
resetMediaAndPosts();
|
826 |
-
ajaxAnimation();
|
827 |
} else {
|
828 |
$(".folder-popup-form").hide();
|
829 |
$(".folder-popup-form").removeClass("disabled");
|
@@ -834,24 +898,23 @@
|
|
834 |
});
|
835 |
}
|
836 |
} else if( ui.draggable.hasClass( 'wcp-move-file' ) ){
|
837 |
-
|
838 |
-
nonce =
|
839 |
chkStr = postID+",";
|
840 |
$(".wp-list-table input:checked").each(function(){
|
841 |
if($(this).val() != postID) {
|
842 |
chkStr += $(this).val() + ",";
|
843 |
}
|
844 |
});
|
845 |
-
|
846 |
url: folders_media_options.ajax_url,
|
847 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
848 |
method: 'post',
|
849 |
success: function (res) {
|
850 |
-
res =
|
851 |
if(res.status == "1") {
|
852 |
// window.location.reload();
|
853 |
resetMediaAndPosts();
|
854 |
-
ajaxAnimation();
|
855 |
} else {
|
856 |
$(".folder-popup-form").hide();
|
857 |
$(".folder-popup-form").removeClass("disabled");
|
@@ -861,16 +924,16 @@
|
|
861 |
}
|
862 |
});
|
863 |
} else if (ui.draggable.hasClass('attachment')) {
|
864 |
-
|
865 |
-
nonce =
|
866 |
-
if ($(".
|
867 |
chkStr = "";
|
868 |
-
$(".
|
869 |
chkStr += $(this).data("id") + ",";
|
870 |
});
|
871 |
}
|
872 |
folderIDs = chkStr;
|
873 |
-
|
874 |
url: folders_media_options.ajax_url,
|
875 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
876 |
method: 'post',
|
@@ -911,9 +974,9 @@
|
|
911 |
});
|
912 |
});
|
913 |
|
914 |
-
$(".un-categorised-items").livequery(function
|
915 |
$(this).droppable({
|
916 |
-
accept: ".wcp-move-file, .wcp-move-multiple, .
|
917 |
hoverClass: 'wcp-hover-list',
|
918 |
classes: {
|
919 |
"ui-droppable-active": "ui-state-highlight"
|
@@ -923,56 +986,53 @@
|
|
923 |
nonce = folders_media_options.nonce;
|
924 |
if (ui.draggable.hasClass('wcp-move-multiple')) {
|
925 |
if ($(".wp-list-table input:checked").length) {
|
926 |
-
|
927 |
-
$(".wp-list-table input:checked").each(function
|
928 |
chkStr += $(this).val() + ",";
|
929 |
});
|
930 |
-
|
931 |
url: folders_media_options.ajax_url,
|
932 |
data: "post_id=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
933 |
method: 'post',
|
934 |
success: function (res) {
|
935 |
//window.location.reload();
|
936 |
resetMediaAndPosts();
|
937 |
-
ajaxAnimation();
|
938 |
}
|
939 |
});
|
940 |
}
|
941 |
} else if (ui.draggable.hasClass('wcp-move-file')) {
|
942 |
-
|
943 |
-
|
944 |
-
$(".wp-list-table input:checked").each(function
|
945 |
if(postID != $(this).val()) {
|
946 |
chkStr += $(this).val() + ",";
|
947 |
}
|
948 |
});
|
949 |
-
|
950 |
url: folders_media_options.ajax_url,
|
951 |
data: "post_id=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
952 |
method: 'post',
|
953 |
success: function (res) {
|
954 |
//window.location.reload();
|
955 |
resetMediaAndPosts();
|
956 |
-
ajaxAnimation();
|
957 |
}
|
958 |
});
|
959 |
} else if (ui.draggable.hasClass('attachment')) {
|
960 |
-
|
961 |
-
if ($(".
|
962 |
chkStr = "";
|
963 |
-
$(".
|
964 |
chkStr += $(this).data("id") + ",";
|
965 |
});
|
966 |
}
|
967 |
folderIDs = chkStr;
|
968 |
-
|
969 |
url: folders_media_options.ajax_url,
|
970 |
data: "post_id=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
971 |
method: 'post',
|
972 |
success: function (res) {
|
973 |
// window.location.reload();
|
974 |
resetMediaAndPosts();
|
975 |
-
ajaxAnimation();
|
976 |
}
|
977 |
});
|
978 |
}
|
@@ -980,9 +1040,10 @@
|
|
980 |
});
|
981 |
});
|
982 |
|
|
|
983 |
$(".tree-structure .folder-item").livequery(function(){
|
984 |
$(this).droppable({
|
985 |
-
accept: ".wcp-move-file, .wcp-move-multiple, .
|
986 |
hoverClass: 'wcp-drop-hover-list',
|
987 |
classes: {
|
988 |
"ui-droppable-active": "ui-state-highlight"
|
@@ -991,13 +1052,13 @@
|
|
991 |
$("body").removeClass("no-hover-css");
|
992 |
folderID = $(this).data('id');
|
993 |
if ( ui.draggable.hasClass( 'wcp-move-multiple' ) ) {
|
994 |
-
nonce =
|
995 |
if($(".wp-list-table input:checked").length) {
|
996 |
-
|
997 |
$(".wp-list-table input:checked").each(function(){
|
998 |
chkStr += $(this).val()+",";
|
999 |
});
|
1000 |
-
|
1001 |
url: folders_media_options.ajax_url,
|
1002 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
1003 |
method: 'post',
|
@@ -1009,15 +1070,15 @@
|
|
1009 |
});
|
1010 |
}
|
1011 |
} else if ( ui.draggable.hasClass( 'wcp-move-file' ) ) {
|
1012 |
-
|
1013 |
-
nonce =
|
1014 |
-
|
1015 |
$(".wp-list-table input:checked").each(function(){
|
1016 |
if($(this).val() != postID) {
|
1017 |
chkStr += $(this).val() + ",";
|
1018 |
}
|
1019 |
});
|
1020 |
-
|
1021 |
url: folders_media_options.ajax_url,
|
1022 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
1023 |
method: 'post',
|
@@ -1028,15 +1089,15 @@
|
|
1028 |
}
|
1029 |
});
|
1030 |
} else if( ui.draggable.hasClass( 'attachment' ) ){
|
1031 |
-
|
1032 |
-
nonce =
|
1033 |
-
if($(".
|
1034 |
chkStr = "";
|
1035 |
-
$(".
|
1036 |
chkStr += $(this).data("id")+",";
|
1037 |
});
|
1038 |
}
|
1039 |
-
|
1040 |
url: folders_media_options.ajax_url,
|
1041 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
1042 |
method: 'post',
|
@@ -1074,7 +1135,7 @@
|
|
1074 |
containment: "document",
|
1075 |
helper: function (event, ui) {
|
1076 |
$(".selected-items").remove();
|
1077 |
-
|
1078 |
if(selectedItems > 0) {
|
1079 |
selectedItems = (selectedItems == 0 || selectedItems == 1) ? "1 Item" : selectedItems + " Items";
|
1080 |
return $("<div class='selected-items'><span class='total-post-count'>" + selectedItems + " Selected</span></div>");
|
@@ -1097,81 +1158,281 @@
|
|
1097 |
});
|
1098 |
});
|
1099 |
|
1100 |
-
$(
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
} else {
|
1124 |
-
if($("#wcp_folder_"+folderID).hasClass("active")) {
|
1125 |
-
$("#wcp_folder_"+folderID).removeClass("active");
|
1126 |
-
$("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideUp();
|
1127 |
-
folderStatus = 0;
|
1128 |
} else {
|
1129 |
-
$("#wcp_folder_"+folderID).
|
1130 |
-
|
1131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1132 |
}
|
1133 |
-
ajaxAnimation();
|
1134 |
}
|
1135 |
-
}
|
1136 |
});
|
1137 |
});
|
1138 |
|
1139 |
$(document).on("keyup", "#folder-search", function(){
|
1140 |
checkForFolderSearch();
|
1141 |
});
|
|
|
1142 |
$(document).on("change", "#folder-search", function(){
|
1143 |
checkForFolderSearch();
|
1144 |
});
|
|
|
1145 |
$(document).on("blur", "#folder-search", function(){
|
1146 |
checkForFolderSearch();
|
1147 |
});
|
1148 |
-
|
1149 |
$(document).on("click","#folder-hide-show-checkbox",function(){
|
1150 |
if($(this).is(":checked")) {
|
1151 |
-
$("#
|
1152 |
} else {
|
1153 |
-
$("#
|
1154 |
-
$("#
|
1155 |
}
|
1156 |
});
|
1157 |
|
1158 |
-
$(document).on("click","
|
1159 |
-
|
1160 |
-
|
|
|
|
|
|
|
|
|
|
|
1161 |
removeFolderFromID(1);
|
1162 |
$(".dynamic-menu").remove();
|
1163 |
$(".active-menu").removeClass("active-menu");
|
1164 |
} else {
|
1165 |
if($("#folder-hide-show-checkbox").is(":checked")) {
|
1166 |
-
//removeMultipleFolderItems();
|
1167 |
$(".dynamic-menu").remove();
|
1168 |
removeFolderFromID(1);
|
1169 |
}
|
1170 |
}
|
1171 |
});
|
1172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1173 |
});
|
1174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1175 |
function removeMultipleFolderItems() {
|
1176 |
if($("#folder-hide-show-checkbox").is(":checked")) {
|
1177 |
if($("#custom-menu input.checkbox:checked").length > 0) {
|
@@ -1184,21 +1445,20 @@
|
|
1184 |
}
|
1185 |
});
|
1186 |
$(".form-loader-count").css("width", "100%");
|
1187 |
-
|
1188 |
url: folders_media_options.ajax_url,
|
1189 |
data: "type=" + folders_media_options.post_type + "&action=wcp_remove_muliple_folder&term_id=" + folderIDs+"&nonce="+folders_media_options.nonce,
|
1190 |
method: 'post',
|
1191 |
success: function (res) {
|
1192 |
-
|
1193 |
$(".form-loader-count").css("width", "0px");
|
1194 |
if (res.status == '1') {
|
1195 |
isKeyActive = parseInt(res.is_key_active);
|
1196 |
n_o_file = parseInt(res.folders);
|
1197 |
$("#current-folder").text(n_o_file);
|
1198 |
-
|
1199 |
-
$(
|
1200 |
-
|
1201 |
-
});
|
1202 |
|
1203 |
$("#ttl-fldr").text((4*2)+(4/2));
|
1204 |
// add_menu_to_list();
|
@@ -1206,6 +1466,7 @@
|
|
1206 |
$(".folder-popup-form").hide();
|
1207 |
$(".folder-popup-form").removeClass("disabled");
|
1208 |
resetMediaAndPosts();
|
|
|
1209 |
|
1210 |
ajaxAnimation();
|
1211 |
|
@@ -1217,8 +1478,8 @@
|
|
1217 |
window.location.reload();
|
1218 |
}
|
1219 |
$("#folder-hide-show-checkbox").attr("checked", false);
|
1220 |
-
$("#
|
1221 |
-
$("#
|
1222 |
}
|
1223 |
});
|
1224 |
} else {
|
@@ -1234,12 +1495,12 @@
|
|
1234 |
$(".select-mode-toggle-button").trigger("click");
|
1235 |
}
|
1236 |
}
|
1237 |
-
if(folderIDs != "" && ($("#
|
1238 |
if($("#media-attachment-taxonomy-filter").length) {
|
1239 |
folderIDs = folderIDs.split(",");
|
1240 |
for (var i = 0; i < folderIDs.length; i++) {
|
1241 |
if(folderIDs[i] != "") {
|
1242 |
-
$(".
|
1243 |
}
|
1244 |
}
|
1245 |
}
|
@@ -1248,12 +1509,13 @@
|
|
1248 |
if($("#media-attachment-taxonomy-filter").length) {
|
1249 |
resetMediaData(0);
|
1250 |
} else {
|
1251 |
-
|
1252 |
url: folders_media_options.ajax_url,
|
1253 |
data: "type=" + folders_media_options.post_type + "&action=get_folders_default_list",
|
1254 |
method: 'post',
|
1255 |
success: function (res) {
|
1256 |
-
|
|
|
1257 |
$(".header-posts .total-count").text(res.total_items);
|
1258 |
$(".un-categorised-items .total-count").text(res.empty_items);
|
1259 |
|
@@ -1262,41 +1524,33 @@
|
|
1262 |
$("#title_"+res.taxonomies[i].term_id+" .star-icon").before("<span class='total-count'></span>");
|
1263 |
}
|
1264 |
$("#title_"+res.taxonomies[i].term_id+" .total-count").text(parseInt(res.taxonomies[i].trash_count));
|
1265 |
-
|
1266 |
-
if(!$(".sticky-folders .sticky-folder-"+res.taxonomies[i].term_id+" .folder-count").length) {
|
1267 |
-
$(".sticky-folders .sticky-folder-"+res.taxonomies[i].term_id+" a").append("<span class='folder-count'></span>")
|
1268 |
-
}
|
1269 |
-
$(".sticky-folders .sticky-folder-"+res.taxonomies[i].term_id+" .folder-count").text(parseInt(res.taxonomies[i].trash_count));
|
1270 |
}
|
1271 |
|
1272 |
-
$("
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
$(".sticky-folders .folder-count").each(function(){
|
1279 |
-
if(parseInt($(this).text()) == 0) {
|
1280 |
-
$(this).remove();
|
1281 |
}
|
1282 |
-
}
|
1283 |
}
|
1284 |
});
|
1285 |
$(".folder-loader-ajax").addClass("active");
|
1286 |
if($("#folder-posts-filter").length) {
|
1287 |
-
$("#folder-posts-filter").load(folderCurrentURL + " #posts-filter", function
|
|
|
|
|
1288 |
if (folders_media_options.show_in_page == "show" && !$(".tree-structure").length) {
|
1289 |
-
$(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>');
|
1290 |
}
|
1291 |
-
add_active_item_to_list();
|
1292 |
triggerInlineUpdate();
|
1293 |
});
|
1294 |
} else {
|
1295 |
$("#wpbody").load(folderCurrentURL + " #wpbody-content", false, function (res) {
|
1296 |
if (folders_media_options.show_in_page == "show" && !$(".tree-structure").length) {
|
1297 |
-
$(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>');
|
1298 |
}
|
1299 |
-
add_active_item_to_list();
|
1300 |
});
|
1301 |
}
|
1302 |
}
|
@@ -1304,11 +1558,16 @@
|
|
1304 |
|
1305 |
function resetDDCounter() {
|
1306 |
var currentDDVal = $("#media-attachment-taxonomy-filter").val();
|
1307 |
-
jQuery.ajax({
|
1308 |
url: folders_media_options.ajax_url,
|
1309 |
data: "type=attachment&action=wcp_get_default_list&active_id=0",
|
1310 |
method: 'post',
|
1311 |
-
|
|
|
|
|
|
|
|
|
|
|
1312 |
var res = jQuery.parseJSON(res);
|
1313 |
|
1314 |
if($("#media-attachment-taxonomy-filter").length) {
|
@@ -1318,13 +1577,9 @@
|
|
1318 |
selectedDD.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>");
|
1319 |
lastFolderData = res.taxonomies;
|
1320 |
for (var i = 0; i < res.taxonomies.length; i++) {
|
1321 |
-
selectedDD.append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].
|
1322 |
}
|
1323 |
selectedDD.val(currentDDVal).trigger("change");
|
1324 |
-
|
1325 |
-
// if(resetMediaID !== false) {
|
1326 |
-
// selectedDD.val(resetMediaID).trigger("change");
|
1327 |
-
// }
|
1328 |
});
|
1329 |
if($("select.folder_for_media").length) {
|
1330 |
var selectedVal = $("select.folder_for_media").val();
|
@@ -1336,56 +1591,22 @@
|
|
1336 |
$(".folder_for_media").val(selectedVal);
|
1337 |
}
|
1338 |
}
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
if(!$(".sticky-folders .sticky-folder-"+res.taxonomies[i].term_id+" .folder-count").length) {
|
1346 |
-
$(".sticky-folders .sticky-folder-"+res.taxonomies[i].term_id+" a").append("<span class='folder-count'></span>")
|
1347 |
}
|
1348 |
-
$(".sticky-folders .sticky-folder-"+res.taxonomies[i].term_id+" .folder-count").text(parseInt(res.taxonomies[i].trash_count));
|
1349 |
-
|
1350 |
-
$("#title_"+res.taxonomies[i].term_id).attr("title", res.taxonomies[i].term_name);
|
1351 |
-
$("#title_"+res.taxonomies[i].term_id+" .title-text").html(res.taxonomies[i].term_name);
|
1352 |
}
|
1353 |
-
|
1354 |
-
$("#custom-menu .total-count").each(function(){
|
1355 |
-
if(parseInt($(this).text()) == 0) {
|
1356 |
-
$(this).remove();
|
1357 |
-
}
|
1358 |
-
});
|
1359 |
-
|
1360 |
-
$(".sticky-folders .folder-count").each(function(){
|
1361 |
-
if(parseInt($(this).text()) == 0) {
|
1362 |
-
$(this).remove();
|
1363 |
-
}
|
1364 |
-
});
|
1365 |
}
|
1366 |
}
|
1367 |
});
|
1368 |
}
|
1369 |
|
1370 |
function checkForFolderSearch() {
|
1371 |
-
|
1372 |
-
|
1373 |
-
$("#custom-menu").addClass("has-filter");
|
1374 |
-
var searchText = ($.trim($("#folder-search").val())).toLowerCase();
|
1375 |
-
$("#custom-menu span.title-text").removeClass("has-search-text");
|
1376 |
-
$("li.route").removeClass("has-search");
|
1377 |
-
$("#custom-menu span.title-text").each(function(){
|
1378 |
-
var thisText = ($(this).text()).toLowerCase();
|
1379 |
-
if(thisText.indexOf(searchText) !== -1) {
|
1380 |
-
$(this).addClass("has-search-text");
|
1381 |
-
$(this).parents("li.route").addClass("has-search");
|
1382 |
-
}
|
1383 |
-
});
|
1384 |
-
} else {
|
1385 |
-
$("#custom-menu").removeClass("has-filter");
|
1386 |
-
$("#custom-menu span.title-text").removeClass("has-search-text");
|
1387 |
-
$("li.route").removeClass("has-search");
|
1388 |
-
}
|
1389 |
}
|
1390 |
|
1391 |
function removeFolderFromID(popup_type) {
|
@@ -1395,14 +1616,14 @@
|
|
1395 |
if(popup_type == 1) {
|
1396 |
if($("#folder-hide-show-checkbox").is(":checked")) {
|
1397 |
isMultipleRemove = true;
|
1398 |
-
if($("#
|
1399 |
$(".folder-popup-form").hide();
|
1400 |
$(".folder-popup-form").removeClass("disabled");
|
1401 |
$("#error-folder-popup-message").html("Please select at least one folder to delete");
|
1402 |
$("#error-folder-popup").show();
|
1403 |
return;
|
1404 |
} else {
|
1405 |
-
if($("#
|
1406 |
removeMessage = "Are you sure you want to delete the selected folders?";
|
1407 |
removeNotice = "Items in the selected folders will not be deleted.";
|
1408 |
}
|
@@ -1419,24 +1640,22 @@
|
|
1419 |
}
|
1420 |
|
1421 |
function updateFolder() {
|
1422 |
-
|
1423 |
-
|
1424 |
if(parentID == undefined) {
|
1425 |
parentID = 0;
|
1426 |
}
|
1427 |
|
1428 |
-
$(".dynamic-menu").hide();
|
1429 |
$("#update-folder-data").text("Submit");
|
1430 |
$(".folder-form-errors").removeClass("active");
|
1431 |
$("#update-folder-item-name").val(folderName);
|
1432 |
$("#update-folder-item").removeClass("disabled");
|
1433 |
$("#update-folder-item").show();
|
1434 |
$("#update-folder-item-name").focus();
|
|
|
1435 |
}
|
1436 |
|
1437 |
function addFolder() {
|
1438 |
-
isKeyActive = parseInt(folders_media_options.is_key_active);
|
1439 |
-
|
1440 |
if(isKeyActive == 0 && n_o_file >= ((4*4)-(3*3)+(4/4)+(8/(2*2)))) {
|
1441 |
$("#folder-limitation-message").html("You've "+"reached the "+((4*4)-(2*2)-2)+" folder limitation!");
|
1442 |
$("#no-more-folder-credit").show();
|
@@ -1449,44 +1668,58 @@
|
|
1449 |
$("#add-update-folder-name").val("");
|
1450 |
if(isDuplicate) {
|
1451 |
duplicateFolderId = fileFolderID;
|
1452 |
-
$("#add-update-folder-name").val($("#
|
1453 |
-
if($("
|
1454 |
-
fileFolderID =
|
1455 |
} else {
|
1456 |
-
fileFolderID =
|
1457 |
}
|
1458 |
}
|
1459 |
|
1460 |
-
folderOrder = $("#space_"+fileFolderID+" > li").length+1;
|
1461 |
-
ajaxURL = folders_media_options.ajax_url+"?parent_id=" + fileFolderID + "&type=" + folders_media_options.post_type + "&action=wcp_add_new_folder&nonce=" + folders_media_options.nonce + "&term_id=" + fileFolderID + "&order=" + folderOrder+"&name=";
|
1462 |
-
|
1463 |
$("#add-update-folder").removeClass("disabled");
|
1464 |
$("#add-update-folder").show();
|
1465 |
$("#add-update-folder-name").focus();
|
|
|
1466 |
}
|
1467 |
|
1468 |
function checkForExpandCollapse() {
|
1469 |
-
|
1470 |
-
|
1471 |
-
$("#
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1476 |
}
|
1477 |
|
|
|
1478 |
function resetMediaData(loadData) {
|
1479 |
-
|
1480 |
url: folders_media_options.ajax_url,
|
1481 |
data: "type=" + folders_media_options.post_type + "&action=wcp_get_default_list&active_id="+activeRecordID,
|
1482 |
method: 'post',
|
|
|
|
|
|
|
|
|
|
|
|
|
1483 |
success: function (res) {
|
1484 |
-
res =
|
1485 |
-
// $("#
|
1486 |
$(".header-posts .total-count").text(res.total_items);
|
1487 |
$(".un-categorised-items .total-count").text(res.empty_items);
|
1488 |
-
|
1489 |
-
if(selectedVal != "all") {
|
1490 |
var wp1 = parent.wp;
|
1491 |
if(wp1.media != undefined) {
|
1492 |
wp1.media.frame.setState('insert');
|
@@ -1502,14 +1735,11 @@
|
|
1502 |
if($("#media-attachment-taxonomy-filter").length) {
|
1503 |
folders_media_options.terms = res.taxonomies;
|
1504 |
var selectedDD = $("#media-attachment-taxonomy-filter");
|
1505 |
-
selectedDD.html("<option value='all'>All Folders</option><option value='
|
1506 |
$(".media-select-folder").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>");
|
1507 |
-
for (
|
1508 |
selectedDD.append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].trash_count + ")</option>");
|
1509 |
$(".media-select-folder").append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].trash_count + ")</option>");
|
1510 |
-
|
1511 |
-
$("#title_"+res.taxonomies[i].term_id).attr("title", res.taxonomies[i].term_name);
|
1512 |
-
$("#title_"+res.taxonomies[i].term_id+" .title-text").html(res.taxonomies[i].term_name);
|
1513 |
}
|
1514 |
selectedDD.val(selectedVal);
|
1515 |
$(".media-select-folder").val("");
|
@@ -1517,40 +1747,22 @@
|
|
1517 |
if($("select.folder_for_media").length) {
|
1518 |
selectedVal = $("select.folder_for_media").val();
|
1519 |
$("select.folder_for_media option:not(:first-child):not(:last-child)").remove();
|
1520 |
-
for (
|
1521 |
$("select.folder_for_media option:last-child").before("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name +"</option>");
|
1522 |
}
|
1523 |
if(selectedVal != "") {
|
1524 |
$(".folder_for_media").val(selectedVal);
|
1525 |
}
|
1526 |
}
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
if(!$(".sticky-folders .sticky-folder-"+res.taxonomies[i].term_id+" .folder-count").length) {
|
1534 |
-
$(".sticky-folders .sticky-folder-"+res.taxonomies[i].term_id+" a").append("<span class='folder-count'></span>")
|
1535 |
}
|
1536 |
-
$(".sticky-folders .sticky-folder-"+res.taxonomies[i].term_id+" .folder-count").text(parseInt(res.taxonomies[i].trash_count));
|
1537 |
-
|
1538 |
-
$("#title_"+res.taxonomies[i].term_id).attr("title", res.taxonomies[i].term_name);
|
1539 |
-
$("#title_"+res.taxonomies[i].term_id+" .title-text").html(res.taxonomies[i].term_name);
|
1540 |
}
|
1541 |
-
|
1542 |
-
$("#custom-menu .total-count").each(function(){
|
1543 |
-
if(parseInt($(this).text()) == 0) {
|
1544 |
-
$(this).remove();
|
1545 |
-
}
|
1546 |
-
});
|
1547 |
-
|
1548 |
-
$(".sticky-folders .folder-count").each(function(){
|
1549 |
-
if(parseInt($(this).text()) == 0) {
|
1550 |
-
$(this).remove();
|
1551 |
-
}
|
1552 |
-
});
|
1553 |
}
|
|
|
1554 |
if(activeRecordID != "") {
|
1555 |
$("#wcp_folder_"+activeRecordID).addClass("active-item");
|
1556 |
}
|
@@ -1563,6 +1775,19 @@
|
|
1563 |
});
|
1564 |
}
|
1565 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1566 |
function ajaxAnimation() {
|
1567 |
$(".folder-loader-ajax").addClass("active");
|
1568 |
$(".folder-loader-ajax img").removeClass("active");
|
@@ -1573,22 +1798,4 @@
|
|
1573 |
$(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated");
|
1574 |
}, 2000);
|
1575 |
}
|
1576 |
-
|
1577 |
-
function calcWidth(obj){
|
1578 |
-
var titles =
|
1579 |
-
$(obj).siblings('.space').children('.route').children('.title');
|
1580 |
-
$(titles).each(function(index, element){
|
1581 |
-
var pTitleWidth = parseInt($(obj).css('width'));
|
1582 |
-
var leftOffset = parseInt($(obj).siblings('.space').css('margin-left'));
|
1583 |
-
var newWidth = pTitleWidth - leftOffset;
|
1584 |
-
if ($(obj).attr('id') == 'title_0'){
|
1585 |
-
newWidth = newWidth - 10;
|
1586 |
-
}
|
1587 |
-
$(element).css({
|
1588 |
-
'width': newWidth
|
1589 |
-
});
|
1590 |
-
calcWidth(element);
|
1591 |
-
});
|
1592 |
-
|
1593 |
-
}
|
1594 |
-
})(jQuery, _);
|
1 |
+
(function (factory) {
|
2 |
"use strict";
|
3 |
+
if (typeof define === 'function' && define.amd) {
|
4 |
+
define(['jquery'], factory);
|
5 |
+
}
|
6 |
+
else if(typeof module !== 'undefined' && module.exports) {
|
7 |
+
module.exports = factory(require('jquery'));
|
8 |
+
}
|
9 |
+
else {
|
10 |
+
factory(jQuery);
|
11 |
+
}
|
12 |
+
}(function ($, undefined) {
|
13 |
+
var treeId = "#js-tree-menu";
|
14 |
+
var folderPropertyArray = [];
|
15 |
var selectedFolderMediaId = -1;
|
16 |
var defaultFolderHtml;
|
17 |
var folderID = 0;
|
34 |
var lastOrderStatus = "";
|
35 |
var ajaxURL = "";
|
36 |
var folderOrder = 0;
|
37 |
+
|
38 |
+
var listFolderString = "<li class='grid-view' data-id='__folder_id__' id='folder___folder_id__'>" +
|
39 |
+
"<div class='folder-item is-folder' data-id='__folder_id__'>" +
|
40 |
+
"<a title='__folder_name__' id='folder_view___folder_id__'" +
|
41 |
+
"class='folder-view __append_class__ has-new-folder'" +
|
42 |
+
"data-id='__folder_id__'>" +
|
43 |
+
"<span class='folder item-name'><span id='wcp_folder_text___folder_id__'" +
|
44 |
+
"class='folder-title'>__folder_name__</span></span>" +
|
45 |
+
"</a>" +
|
46 |
+
"</div>" +
|
47 |
+
"</li>";
|
48 |
+
|
49 |
var MediaLibraryOrganizerTaxonomyFilter = wp.media.view.AttachmentFilters.extend({
|
50 |
id: 'media-attachment-taxonomy-filter',
|
51 |
createFilters: function() {
|
107 |
}
|
108 |
});
|
109 |
|
|
|
|
|
110 |
var selectedFolderPageID = "all";
|
111 |
var filesInQueue = 0;
|
112 |
var uploadedFileCount = 0;
|
187 |
});
|
188 |
}
|
189 |
|
190 |
+
if(!$("#wcp-content").length) {
|
191 |
+
if($(".editor-post-featured-image").length) {
|
192 |
+
$(".attachment-filters").val(selectedFolderPageID).trigger("change");
|
193 |
}
|
194 |
}
|
195 |
}
|
266 |
}, open: function () {
|
267 |
$(".folder-modal").removeClass("folder-modal");
|
268 |
if (windowModal.prototype.open.apply(this, arguments)) {
|
|
|
269 |
if($(".folder-modal").length) {
|
270 |
$(".folder-custom-menu").remove();
|
271 |
$(".folder-modal .media-frame-tab-panel").removeClass("has-folder-menu");
|
272 |
if($(".folder-modal .media-frame").hasClass("hide-menu")) {
|
273 |
if (!$(".folder-custom-menu").length) {
|
274 |
+
$(".folder-modal .media-frame-tab-panel").before("<div class='folder-custom-menu'><div class='folder-menu-content'><div class='cssload-container'><div class='cssload-tube-tunnel'></div></div></div></div>");
|
275 |
$(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url + " #wcp-content-resize", function () {
|
276 |
checkForExpandCollapse();
|
277 |
+
initJSTree();
|
278 |
});
|
279 |
}
|
280 |
} else {
|
281 |
if (!$(".folder-custom-menu").length) {
|
282 |
$(".folder-modal .media-frame-menu").addClass("has-folder-menu");
|
283 |
+
$(".folder-modal .media-frame-menu .media-menu").append("<div class='folder-custom-menu'><div class='folder-menu-content'><div class='cssload-container'><div class='cssload-tube-tunnel'></div></div></div></div>");
|
284 |
$(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url + " #wcp-content-resize", function () {
|
285 |
checkForExpandCollapse();
|
286 |
});
|
290 |
$(".folder-form-data").remove();
|
291 |
$(".media-frame-tab-panel:first").before("<div class='folder-form-data'></div>");
|
292 |
$(".folder-form-data").load(folders_media_options.media_page_url+ " #folder-add-update-content", function(){ });
|
293 |
+
} else {
|
294 |
+
setTimeout(function(){
|
295 |
+
if(selectedFolderMediaId != -1) {
|
296 |
+
$("#media-attachment-taxonomy-filter").each(function () {
|
297 |
+
$(this).val(selectedFolderMediaId);
|
298 |
+
$(this).trigger("change");
|
299 |
+
});
|
300 |
+
}
|
301 |
+
}, 1000);
|
302 |
}
|
303 |
}
|
304 |
}, close: function () {
|
305 |
windowModal.prototype.close.apply(this, arguments);
|
306 |
$(".folder-modal").removeClass("folder-modal");
|
307 |
}
|
308 |
+
});
|
309 |
// wpMedia.media.view.Modal.prototype.on('open', function() {
|
310 |
// $(".folder-custom-menu").remove();
|
311 |
// if(!$(".folder-custom-menu").length) {
|
332 |
$(document).on("click", ".header-posts a.all-posts", function(e){
|
333 |
fileFolderID = 0;
|
334 |
activeRecordID = "";
|
335 |
+
selectedFolderMediaId = "all";
|
336 |
$(".active-item").removeClass("active-item");
|
337 |
+
$(".jstree-clicked").removeClass("jstree-clicked");
|
338 |
$(this).addClass("active-item");
|
339 |
+
$(".sticky-folders .active-item").removeClass("active-item");
|
340 |
$(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("all").trigger("change");
|
341 |
$(this).closest(".media-frame").find(".folder_for_media").val("all").trigger("change");
|
342 |
});
|
344 |
$(document).on("click", ".un-categorised-items", function(e){
|
345 |
fileFolderID = 0;
|
346 |
activeRecordID = "";
|
347 |
+
selectedFolderMediaId = "unassigned";
|
348 |
$(".active-item").removeClass("active-item");
|
349 |
+
$(".sticky-folders .active-item").removeClass("active-item");
|
350 |
+
$(".jstree-clicked").removeClass("jstree-clicked");
|
351 |
$(this).addClass("active-item");
|
352 |
$(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("unassigned").trigger("change");
|
353 |
$(this).closest(".media-frame").find(".folder_for_media").val("-1").trigger("change");
|
354 |
});
|
355 |
|
356 |
+
$(document).on("click", "a.jstree-anchor", function(e){
|
357 |
+
var thisIndex = $(this).closest("li.jstree-node").attr("id");
|
358 |
+
fileFolderID = thisIndex;
|
359 |
+
selectedFolderMediaId = fileFolderID;
|
360 |
$(".active-item").removeClass("active-item");
|
361 |
+
$("#media-attachment-taxonomy-filter").val(thisIndex);
|
362 |
+
$("#media-attachment-taxonomy-filter").trigger("change");
|
363 |
+
thisSlug = getSettingForPost(thisIndex, 'slug');
|
364 |
+
set_default_folders(thisSlug);
|
365 |
+
$(".custom-media-select").removeClass("active");
|
366 |
});
|
367 |
|
368 |
$(document).on("change", ".folder_for_media", function(){
|
375 |
|
376 |
/* right click menu */
|
377 |
$(document).on("click", ".update-inline-record", function(e){
|
378 |
+
e.stopImmediatePropagation()
|
379 |
e.stopPropagation();
|
380 |
+
if(folders_media_options.can_manage_folder == 0) {
|
381 |
+
return;
|
382 |
+
}
|
383 |
+
isHigh = $(this).closest("li.sticky-fldr").hasClass("is-high");
|
384 |
+
isSticky = $(this).closest("li.sticky-fldr").hasClass("is-sticky");
|
385 |
+
isStickyClass = (isSticky)?true:false;
|
386 |
$(".dynamic-menu").remove();
|
387 |
$(".active-menu").removeClass("active-menu");
|
388 |
+
menuHtml = "<div class='dynamic-menu'><ul>" +
|
389 |
"<li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li>" +
|
390 |
"<li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li>" +
|
391 |
"<li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li>" +
|
392 |
+
"<li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>" + ((isHigh) ? " Remove Star" : "Add a Star") + "</a></li>"+
|
393 |
"<li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";
|
394 |
|
395 |
+
hasPosts = parseInt($(this).closest("li.jstree-node").find("h3.title:first > .total-count").text());
|
396 |
+
if (folders_media_options.post_type == "attachment" && hasPosts) {
|
397 |
menuHtml += "<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>";
|
398 |
}
|
399 |
menuHtml += "<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li>" +
|
400 |
"</ul></div>";
|
401 |
+
$(this).closest("li").append(menuHtml);
|
402 |
+
if(($(this).offset().top + $(".dynamic-menu").height()) > ($(window).height() - 20)) {
|
|
|
|
|
403 |
$(".dynamic-menu").addClass("bottom-fix");
|
404 |
|
405 |
if($(".dynamic-menu.bottom-fix").offset().top < $("#custom-scroll-menu").offset().top) {
|
413 |
$(".active-menu").removeClass("active-menu");
|
414 |
$(".folder-order").removeClass("active");
|
415 |
});
|
416 |
+
|
417 |
$(document).on("click", ".dynamic-menu, .folder-order", function(e){
|
418 |
e.stopPropagation();
|
419 |
});
|
420 |
|
421 |
+
$(document).on("contextmenu", ".jstree-anchor", function(e){
|
422 |
+
$(this).find("span.folder-inline-edit").trigger("click");
|
423 |
+
return false;
|
424 |
+
});
|
425 |
+
|
426 |
+
/* right click menu end */
|
427 |
+
$(document).on("click", ".folder-actions span.folder-inline-edit", function(e){
|
428 |
+
e.stopImmediatePropagation()
|
429 |
+
e.stopPropagation();
|
430 |
if(folders_media_options.can_manage_folder == 0) {
|
431 |
+
return;
|
432 |
}
|
433 |
+
isHigh = $(this).closest("li.jstree-node").hasClass("is-high");
|
434 |
+
isSticky = $(this).closest("li.jstree-node").hasClass("is-sticky");
|
435 |
+
isStickyClass = (isSticky)?true:false;
|
436 |
$(".dynamic-menu").remove();
|
437 |
$(".active-menu").removeClass("active-menu");
|
438 |
+
menuHtml = "<div class='dynamic-menu'><ul>" +
|
439 |
"<li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li>" +
|
440 |
"<li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li>" +
|
441 |
"<li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li>" +
|
442 |
"<li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>" + ((isHigh) ? " Remove Star" : "Add a Star") + "</a></li>"+
|
443 |
"<li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>";
|
444 |
|
445 |
+
hasPosts = parseInt($(this).closest("a.jstree-anchor").find(".premio-folder-count").text());
|
446 |
+
if (folders_media_options.post_type == "attachment" && hasPosts) {
|
|
|
447 |
menuHtml += "<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>";
|
448 |
}
|
449 |
menuHtml += "<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li>" +
|
450 |
"</ul></div>";
|
451 |
+
$(this).closest("a.jstree-anchor").after(menuHtml);
|
452 |
+
$(this).parents("li.jstree-node").addClass("active-menu");
|
453 |
if(($(this).offset().top + $(".dynamic-menu").height()) > ($(window).height() - 20)) {
|
454 |
$(".dynamic-menu").addClass("bottom-fix");
|
455 |
|
457 |
$(".dynamic-menu").removeClass("bottom-fix");
|
458 |
}
|
459 |
}
|
|
|
460 |
});
|
461 |
+
|
462 |
+
$(document).on("click", ".dynamic-menu", function(e){
|
463 |
+
e.stopImmediatePropagation()
|
464 |
+
e.stopPropagation();
|
465 |
+
});
|
466 |
+
|
467 |
+
$(document).on("click", "body, html", function(){
|
468 |
+
$(".dynamic-menu").remove();
|
469 |
+
});
|
470 |
|
471 |
/* add new folder functionality */
|
472 |
$(document).on("click", ".new-folder", function(e) {
|
473 |
e.stopPropagation();
|
474 |
+
if($(this).closest("li.jstree-node").length) {
|
475 |
+
fileFolderID = $(this).closest("li.jstree-node").attr("id");
|
476 |
+
} else {
|
477 |
+
fileFolderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
478 |
+
}
|
479 |
$(".dynamic-menu").remove();
|
480 |
$(".active-menu").removeClass("active-menu");
|
481 |
isItFromMedia = false;
|
506 |
$("#save-folder-data").html('<span class="dashicons dashicons-update"></span>');
|
507 |
$("#add-update-folder").addClass("disabled");
|
508 |
|
509 |
+
var parentId = fileFolderID;
|
510 |
if(isItFromMedia) {
|
511 |
+
parentId = 0;
|
512 |
}
|
513 |
|
514 |
+
if(parentId == 0) {
|
515 |
+
folderOrder = $("#js-tree-menu > ul > li.jstree-node").length;
|
516 |
+
} else {
|
517 |
+
folderOrder = $("#js-tree-menu > ul > li.jstree-node[id='"+parentId+"'] > ul.jstree-children > li").length + 1;
|
518 |
+
}
|
519 |
+
|
520 |
+
$.ajax({
|
521 |
url: folders_media_options.ajax_url,
|
522 |
+
data: {
|
523 |
+
parent_id: parentId,
|
524 |
+
type: folders_media_options.post_type,
|
525 |
+
action: "wcp_add_new_folder",
|
526 |
+
nonce: folders_media_options.nonce,
|
527 |
+
term_id: parentId,
|
528 |
+
order: folderOrder,
|
529 |
+
name: folderNameDynamic,
|
530 |
+
is_duplicate: isDuplicate,
|
531 |
+
duplicate_from: duplicateFolderId
|
532 |
+
},
|
533 |
method: 'post',
|
534 |
success: function (res) {
|
535 |
+
result = $.parseJSON(res);
|
536 |
if (result.status == '1') {
|
|
|
|
|
537 |
isKeyActive = parseInt(result.is_key_active);
|
538 |
n_o_file = parseInt(result.folders);
|
539 |
$("#current-folder").text(n_o_file);
|
541 |
checkForExpandCollapse();
|
542 |
$(".folder-popup-form").hide();
|
543 |
$(".folder-popup-form").removeClass("disabled");
|
544 |
+
var folderProperty = {
|
545 |
+
'folder_id': result.term_id,
|
546 |
+
'folder_count': 0,
|
547 |
+
'is_sticky': 0,
|
548 |
+
'is_high': 0,
|
549 |
+
'nonce': result.nonce,
|
550 |
+
'slug': result.slug,
|
551 |
+
'is_deleted': 0
|
552 |
+
};
|
553 |
+
folderPropertyArray.push(folderProperty);
|
554 |
ajaxAnimation();
|
555 |
+
make_sticky_folder_menu();
|
556 |
+
$('#js-tree-menu').jstree().create_node(result.parent_id, { "id" : result.term_id, "text" : " "+result.title }, "last", function(){
|
557 |
+
$(".jstree-node[id='"+result.term_id+"']").attr("data-nonce", result.nonce);
|
558 |
+
$(".jstree-node[id='"+result.term_id+"']").attr("data-slug", result.slug);
|
559 |
+
});
|
560 |
+
//if($("#media-attachment-taxonomy-filter").length) {
|
561 |
+
fileFolderID = result.term_id;
|
562 |
+
resetMediaData(0);
|
563 |
+
//}
|
564 |
} else {
|
565 |
$(".folder-popup-form").hide();
|
566 |
$(".folder-popup-form").removeClass("disabled");
|
576 |
$(document).on("click", ".form-cancel-btn", function(){
|
577 |
$(".folder-popup-form").hide();
|
578 |
});
|
579 |
+
|
580 |
$(document).on("click", ".folder-popup-form", function (e) {
|
581 |
$(".folder-popup-form").hide();
|
582 |
});
|
583 |
+
|
584 |
$(document).on("click", ".popup-form-content", function (e) {
|
585 |
e.stopPropagation();
|
586 |
});
|
599 |
};
|
600 |
|
601 |
/* Update folder */
|
602 |
+
$(".rename-folder").livequery(function(){
|
603 |
+
$(this).click(function(e){
|
604 |
+
e.stopPropagation();
|
605 |
+
if($(this).closest("li.jstree-node").length) {
|
606 |
+
fileFolderID = $(this).closest("li.jstree-node").attr("id");
|
607 |
+
} else {
|
608 |
+
fileFolderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
609 |
+
}
|
610 |
+
updateFolder();
|
611 |
+
$(".dynamic-menu").remove();
|
612 |
+
});
|
613 |
});
|
614 |
|
615 |
$(document).on("click", "#inline-update", function (e) {
|
616 |
+
if($("#js-tree-menu a.jstree-clicked").length) {
|
617 |
+
fileFolderID = $("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id");
|
618 |
updateFolder();
|
619 |
}
|
620 |
});
|
622 |
$(document).on("submit", "#update-folder-form", function(e){
|
623 |
e.stopPropagation();
|
624 |
e.preventDefault();
|
625 |
+
|
626 |
folderNameDynamic = $("#update-folder-item-name").val();
|
627 |
|
628 |
if($.trim(folderNameDynamic) == "") {
|
632 |
$("#update-folder-data").html('<span class="dashicons dashicons-update"></span>');
|
633 |
$("#update-folder-item").addClass("disabled");
|
634 |
|
635 |
+
nonce = getSettingForPost(fileFolderID, 'nonce');
|
636 |
+
parentID = $(".jstree-node[id='"+fileFolderID+"']").closest("li.jstree-node").attr("id");
|
637 |
if (parentID == undefined) {
|
638 |
parentID = 0;
|
639 |
}
|
640 |
+
$.ajax({
|
641 |
url: folders_media_options.ajax_url,
|
642 |
+
data: {
|
643 |
+
parent_id: parentID,
|
644 |
+
type: folders_media_options.post_type,
|
645 |
+
action: "wcp_update_folder",
|
646 |
+
nonce: nonce,
|
647 |
+
term_id: fileFolderID,
|
648 |
+
order: folderOrder,
|
649 |
+
name: folderNameDynamic
|
650 |
+
},
|
651 |
method: 'post',
|
652 |
success: function (res) {
|
653 |
+
result = $.parseJSON(res);
|
654 |
if (result.status == '1') {
|
655 |
+
$("#js-tree-menu").jstree('rename_node', result.id , " "+result.term_title);
|
656 |
+
folderPostId = getIndexForPostSetting(result.id);
|
657 |
+
if(folderPostId != null) {
|
658 |
+
folderPropertyArray[folderPostId]['nonce'] = result.nonce;
|
659 |
+
folderPropertyArray[folderPostId]['slug'] = result.slug;
|
660 |
+
}
|
661 |
+
$(".folder-popup-form").hide();
|
662 |
$(".folder-popup-form").hide();
|
663 |
$(".folder-popup-form").removeClass("disabled");
|
664 |
ajaxAnimation();
|
665 |
+
if($("#media-attachment-taxonomy-filter").length) {
|
666 |
+
resetMediaData(0)
|
667 |
+
}
|
668 |
} else {
|
669 |
$(".folder-popup-form").hide();
|
670 |
$(".folder-popup-form").removeClass("disabled");
|
678 |
});
|
679 |
|
680 |
/* Mark Folder */
|
681 |
+
$(".mark-folder").livequery(function(){
|
682 |
+
$(this).click(function(e){
|
683 |
+
e.stopPropagation();
|
684 |
+
if($(this).closest("li.jstree-node").length) {
|
685 |
+
folderID = $(this).closest("li.jstree-node").attr("id");
|
686 |
+
} else {
|
687 |
+
folderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
688 |
+
}
|
689 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
690 |
+
$(".form-loader-count").css("width","100%");
|
691 |
+
$(".dynamic-menu").remove();
|
692 |
+
$(".active-menu").removeClass("active-menu");
|
693 |
+
$.ajax({
|
694 |
+
url: folders_media_options.ajax_url,
|
695 |
+
data: "term_id=" + folderID + "&type=" + folders_media_options.post_type + "&action=wcp_mark_un_mark_folder&nonce="+nonce,
|
696 |
+
method: 'post',
|
697 |
+
cache: false,
|
698 |
+
success: function (res) {
|
699 |
+
res = $.parseJSON(res);
|
700 |
+
$(".form-loader-count").css("width","0%");
|
701 |
+
if (res.status == '1') {
|
702 |
+
folderPostId = getIndexForPostSetting(res.id);
|
703 |
+
if(res.marked == '1') {
|
704 |
+
$("li.jstree-node[id='"+res.id+"']").addClass("is-high");
|
705 |
+
$(".sticky-folder-"+res.id).addClass("is-high");
|
706 |
+
if(folderPostId != null) {
|
707 |
+
folderPropertyArray[folderPostId]['is_high'] = 1;
|
708 |
+
}
|
709 |
+
} else {
|
710 |
+
$("li.jstree-node[id='"+res.id+"']").removeClass("is-high");
|
711 |
+
$(".sticky-folder-"+res.id).removeClass("is-high");
|
712 |
+
if(folderPostId != null) {
|
713 |
+
folderPropertyArray[folderPostId]['is_high'] = 0;
|
714 |
+
}
|
715 |
+
}
|
716 |
+
ajaxAnimation();
|
717 |
} else {
|
718 |
+
$(".folder-popup-form").hide();
|
719 |
+
$(".folder-popup-form").removeClass("disabled");
|
720 |
+
$("#error-folder-popup-message").html(res.message);
|
721 |
+
$("#error-folder-popup").show();
|
722 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
723 |
}
|
724 |
+
});
|
725 |
});
|
726 |
});
|
727 |
|
728 |
/* Duplicate Folder */
|
729 |
+
$(".duplicate-folder").livequery(function(){
|
730 |
+
$(this).click(function(e) {
|
731 |
+
e.stopPropagation();
|
732 |
+
if($(this).closest("li.jstree-node").length) {
|
733 |
+
fileFolderID = $(this).closest("li.jstree-node").attr("id");
|
734 |
+
} else {
|
735 |
+
fileFolderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
736 |
+
}
|
737 |
+
$(".dynamic-menu").remove();
|
738 |
+
isItFromMedia = false;
|
739 |
+
isDuplicate = true;
|
740 |
+
addFolder();
|
741 |
+
});
|
742 |
});
|
743 |
|
744 |
/* Remove folder */
|
745 |
+
$(".remove-folder").livequery(function(){
|
746 |
+
$(this).click(function() {
|
747 |
+
folderID = $(this).closest("li.jstree-node").data("id");
|
748 |
+
if($(this).closest("li.jstree-node").length) {
|
749 |
+
fileFolderID = $(this).closest("li.jstree-node").attr("id");
|
750 |
+
} else {
|
751 |
+
fileFolderID = $(this).closest("li.sticky-fldr").data("folder-id");
|
752 |
+
}
|
753 |
+
removeFolderFromID(0);
|
754 |
+
$(".dynamic-menu").remove();
|
755 |
+
$(".active-menu").removeClass("active-menu");
|
756 |
+
});
|
757 |
});
|
758 |
+
|
759 |
$(document).on("click", "#remove-folder-item", function (e){
|
760 |
e.stopPropagation();
|
761 |
$(".folder-popup-form").addClass("disabled");
|
762 |
$("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>');
|
763 |
+
nonce = getSettingForPost(fileFolderID, 'nonce');
|
764 |
if(isMultipleRemove) {
|
765 |
removeMultipleFolderItems();
|
766 |
} else {
|
767 |
+
$.ajax({
|
768 |
url: folders_media_options.ajax_url,
|
769 |
data: "type=" + folders_media_options.post_type + "&action=wcp_remove_folder&term_id=" + fileFolderID + "&nonce=" + nonce,
|
770 |
method: 'post',
|
771 |
success: function (res) {
|
772 |
+
res = $.parseJSON(res);
|
773 |
if (res.status == '1') {
|
774 |
+
$('#js-tree-menu').jstree().delete_node(fileFolderID);
|
|
|
775 |
isKeyActive = parseInt(res.is_key_active);
|
776 |
n_o_file = parseInt(res.folders);
|
777 |
$("#current-folder").text(n_o_file);
|
778 |
$("#ttl-fldr").text((3*3)+(4/(2*2)));
|
779 |
+
$(".sticky-folders .sticky-folder-"+fileFolderID).remove();
|
780 |
ajaxAnimation();
|
781 |
$(".folder-popup-form").hide();
|
782 |
$(".folder-popup-form").removeClass("disabled");
|
783 |
+
resetMediaAndPosts();
|
784 |
+
make_sticky_folder_menu();
|
785 |
if (activeRecordID == fileFolderID) {
|
786 |
+
$(".header-posts").trigger("click");
|
787 |
}
|
|
|
788 |
} else {
|
789 |
$(".folder-popup-form").hide();
|
790 |
$(".folder-popup-form").removeClass("disabled");
|
806 |
var statusType = 0;
|
807 |
if($(this).hasClass("all-open")) {
|
808 |
$(this).removeClass("all-open");
|
|
|
809 |
statusType = 0;
|
810 |
$(this).attr("data-folder-tooltip","Expand");
|
811 |
+
$("#js-tree-menu").jstree("close_all");
|
812 |
} else {
|
813 |
$(this).addClass("all-open");
|
814 |
statusType = 1;
|
|
|
815 |
$(this).attr("data-folder-tooltip","Collapse");
|
816 |
+
$("#js-tree-menu").jstree("open_all");
|
817 |
}
|
818 |
folderIDs = "";
|
819 |
+
$("#js-tree-menu .jstree-node:not(.jstree-leaf)").each(function(){
|
820 |
+
folderIDs += $(this).attr("id")+",";
|
821 |
});
|
822 |
if(folderIDs != "") {
|
823 |
$(".form-loader-count").css("width","100%");
|
854 |
success: function (res) {
|
855 |
res = jQuery.parseJSON(res);
|
856 |
if(res.status == 1) {
|
857 |
+
$("#js-tree-menu").jstree().destroy();
|
858 |
+
$("#js-tree-menu").append("<ul></ul>");
|
859 |
+
$("#js-tree-menu ul").html(res.data);
|
860 |
+
initJSTree();
|
861 |
}
|
862 |
$(".form-loader-count").css("width", "0");
|
863 |
}
|
864 |
});
|
865 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
866 |
|
867 |
+
$(".jstree-anchor").livequery(function(){
|
868 |
$(this).droppable({
|
869 |
+
accept: ".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",
|
870 |
hoverClass: 'wcp-drop-hover',
|
871 |
classes: {
|
872 |
"ui-droppable-active": "ui-state-highlight"
|
873 |
},
|
874 |
drop: function( event, ui ) {
|
875 |
+
folderID = $(this).closest("li.jstree-node").attr('id');
|
876 |
+
if ( ui.draggable.hasClass( 'wcp-move-multiple')) {
|
877 |
if($(".wp-list-table input:checked").length) {
|
878 |
+
chkStr = "";
|
879 |
$(".wp-list-table input:checked").each(function(){
|
880 |
chkStr += $(this).val()+",";
|
881 |
});
|
882 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
883 |
+
$.ajax({
|
884 |
url: folders_media_options.ajax_url,
|
885 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
886 |
method: 'post',
|
887 |
success: function (res) {
|
888 |
+
res = $.parseJSON(res);
|
889 |
if(res.status == "1") {
|
890 |
resetMediaAndPosts();
|
|
|
891 |
} else {
|
892 |
$(".folder-popup-form").hide();
|
893 |
$(".folder-popup-form").removeClass("disabled");
|
898 |
});
|
899 |
}
|
900 |
} else if( ui.draggable.hasClass( 'wcp-move-file' ) ){
|
901 |
+
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
902 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
903 |
chkStr = postID+",";
|
904 |
$(".wp-list-table input:checked").each(function(){
|
905 |
if($(this).val() != postID) {
|
906 |
chkStr += $(this).val() + ",";
|
907 |
}
|
908 |
});
|
909 |
+
$.ajax({
|
910 |
url: folders_media_options.ajax_url,
|
911 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID+"&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
912 |
method: 'post',
|
913 |
success: function (res) {
|
914 |
+
res = $.parseJSON(res);
|
915 |
if(res.status == "1") {
|
916 |
// window.location.reload();
|
917 |
resetMediaAndPosts();
|
|
|
918 |
} else {
|
919 |
$(".folder-popup-form").hide();
|
920 |
$(".folder-popup-form").removeClass("disabled");
|
924 |
}
|
925 |
});
|
926 |
} else if (ui.draggable.hasClass('attachment')) {
|
927 |
+
chkStr = ui.draggable[0].attributes['data-id'].nodeValue;
|
928 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
929 |
+
if ($(".attachments-browser li.attachment.selected").length > 1) {
|
930 |
chkStr = "";
|
931 |
+
$(".attachments-browser li.attachment.selected").each(function(){
|
932 |
chkStr += $(this).data("id") + ",";
|
933 |
});
|
934 |
}
|
935 |
folderIDs = chkStr;
|
936 |
+
$.ajax({
|
937 |
url: folders_media_options.ajax_url,
|
938 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
939 |
method: 'post',
|
974 |
});
|
975 |
});
|
976 |
|
977 |
+
$(".un-categorised-items").livequery(function(){
|
978 |
$(this).droppable({
|
979 |
+
accept: ".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",
|
980 |
hoverClass: 'wcp-hover-list',
|
981 |
classes: {
|
982 |
"ui-droppable-active": "ui-state-highlight"
|
986 |
nonce = folders_media_options.nonce;
|
987 |
if (ui.draggable.hasClass('wcp-move-multiple')) {
|
988 |
if ($(".wp-list-table input:checked").length) {
|
989 |
+
chkStr = "";
|
990 |
+
$(".wp-list-table input:checked").each(function(){
|
991 |
chkStr += $(this).val() + ",";
|
992 |
});
|
993 |
+
$.ajax({
|
994 |
url: folders_media_options.ajax_url,
|
995 |
data: "post_id=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
996 |
method: 'post',
|
997 |
success: function (res) {
|
998 |
//window.location.reload();
|
999 |
resetMediaAndPosts();
|
|
|
1000 |
}
|
1001 |
});
|
1002 |
}
|
1003 |
} else if (ui.draggable.hasClass('wcp-move-file')) {
|
1004 |
+
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
1005 |
+
chkStr = postID+",";
|
1006 |
+
$(".wp-list-table input:checked").each(function(){
|
1007 |
if(postID != $(this).val()) {
|
1008 |
chkStr += $(this).val() + ",";
|
1009 |
}
|
1010 |
});
|
1011 |
+
$.ajax({
|
1012 |
url: folders_media_options.ajax_url,
|
1013 |
data: "post_id=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
1014 |
method: 'post',
|
1015 |
success: function (res) {
|
1016 |
//window.location.reload();
|
1017 |
resetMediaAndPosts();
|
|
|
1018 |
}
|
1019 |
});
|
1020 |
} else if (ui.draggable.hasClass('attachment')) {
|
1021 |
+
chkStr = ui.draggable[0].attributes['data-id'].nodeValue;
|
1022 |
+
if ($(".attachments-browser li.attachment.selected").length > 1) {
|
1023 |
chkStr = "";
|
1024 |
+
$(".attachments-browser li.attachment.selected").each(function(){
|
1025 |
chkStr += $(this).data("id") + ",";
|
1026 |
});
|
1027 |
}
|
1028 |
folderIDs = chkStr;
|
1029 |
+
$.ajax({
|
1030 |
url: folders_media_options.ajax_url,
|
1031 |
data: "post_id=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_remove_post_folder&folder_id=" + folderID + "&nonce=" + nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
1032 |
method: 'post',
|
1033 |
success: function (res) {
|
1034 |
// window.location.reload();
|
1035 |
resetMediaAndPosts();
|
|
|
1036 |
}
|
1037 |
});
|
1038 |
}
|
1040 |
});
|
1041 |
});
|
1042 |
|
1043 |
+
//
|
1044 |
$(".tree-structure .folder-item").livequery(function(){
|
1045 |
$(this).droppable({
|
1046 |
+
accept: ".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",
|
1047 |
hoverClass: 'wcp-drop-hover-list',
|
1048 |
classes: {
|
1049 |
"ui-droppable-active": "ui-state-highlight"
|
1052 |
$("body").removeClass("no-hover-css");
|
1053 |
folderID = $(this).data('id');
|
1054 |
if ( ui.draggable.hasClass( 'wcp-move-multiple' ) ) {
|
1055 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
1056 |
if($(".wp-list-table input:checked").length) {
|
1057 |
+
chkStr = "";
|
1058 |
$(".wp-list-table input:checked").each(function(){
|
1059 |
chkStr += $(this).val()+",";
|
1060 |
});
|
1061 |
+
$.ajax({
|
1062 |
url: folders_media_options.ajax_url,
|
1063 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
1064 |
method: 'post',
|
1070 |
});
|
1071 |
}
|
1072 |
} else if ( ui.draggable.hasClass( 'wcp-move-file' ) ) {
|
1073 |
+
postID = ui.draggable[0].attributes['data-id'].nodeValue;
|
1074 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
1075 |
+
chkStr = postID+",";
|
1076 |
$(".wp-list-table input:checked").each(function(){
|
1077 |
if($(this).val() != postID) {
|
1078 |
chkStr += $(this).val() + ",";
|
1079 |
}
|
1080 |
});
|
1081 |
+
$.ajax({
|
1082 |
url: folders_media_options.ajax_url,
|
1083 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
1084 |
method: 'post',
|
1089 |
}
|
1090 |
});
|
1091 |
} else if( ui.draggable.hasClass( 'attachment' ) ){
|
1092 |
+
chkStr = ui.draggable[0].attributes['data-id'].nodeValue;
|
1093 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
1094 |
+
if($(".attachments-browser li.attachment.selected").length > 1) {
|
1095 |
chkStr = "";
|
1096 |
+
$(".attachments-browser li.attachment.selected").each(function(){
|
1097 |
chkStr += $(this).data("id")+",";
|
1098 |
});
|
1099 |
}
|
1100 |
+
$.ajax({
|
1101 |
url: folders_media_options.ajax_url,
|
1102 |
data: "post_ids=" + chkStr + "&type=" + folders_media_options.post_type + "&action=wcp_change_multiple_post_folder&folder_id=" + folderID + "&nonce="+nonce+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+activeRecordID,
|
1103 |
method: 'post',
|
1135 |
containment: "document",
|
1136 |
helper: function (event, ui) {
|
1137 |
$(".selected-items").remove();
|
1138 |
+
selectedItems = $("#the-list th input:checked").length;
|
1139 |
if(selectedItems > 0) {
|
1140 |
selectedItems = (selectedItems == 0 || selectedItems == 1) ? "1 Item" : selectedItems + " Items";
|
1141 |
return $("<div class='selected-items'><span class='total-post-count'>" + selectedItems + " Selected</span></div>");
|
1158 |
});
|
1159 |
});
|
1160 |
|
1161 |
+
$(".jstree-node .jstree-icon").livequery(function(){
|
1162 |
+
$(this).click(function(){
|
1163 |
+
folderID = $(this).closest("li.jstree-node").attr("id");
|
1164 |
+
if($("li.jstree-node[id='"+folderID+"']").hasClass("jstree-open")) {
|
1165 |
+
folderStatus = 0;
|
1166 |
+
} else {
|
1167 |
+
folderStatus = 1;
|
1168 |
+
}
|
1169 |
+
$(".form-loader-count").css("width","100%");
|
1170 |
+
nonce = getSettingForPost(folderID, 'nonce');
|
1171 |
+
checkForExpandCollapse();
|
1172 |
+
jQuery.ajax({
|
1173 |
+
url: folders_media_options.ajax_url,
|
1174 |
+
data: "is_active=" + folderStatus + "&action=save_wcp_folder_state&term_id=" + folderID+"&nonce="+nonce,
|
1175 |
+
method: 'post',
|
1176 |
+
success: function (res) {
|
1177 |
+
$(".form-loader-count").css("width","0");
|
1178 |
+
res = jQuery.parseJSON(res);
|
1179 |
+
if(res.status == "0") {
|
1180 |
+
// $(".folder-popup-form").hide();
|
1181 |
+
// $(".folder-popup-form").removeClass("disabled");
|
1182 |
+
// $("#error-folder-popup-message").html(res.message);
|
1183 |
+
// $("#error-folder-popup").show();
|
|
|
|
|
|
|
|
|
|
|
1184 |
} else {
|
1185 |
+
if($("#wcp_folder_"+folderID).hasClass("active")) {
|
1186 |
+
$("#wcp_folder_"+folderID).removeClass("active");
|
1187 |
+
$("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideUp();
|
1188 |
+
folderStatus = 0;
|
1189 |
+
} else {
|
1190 |
+
$("#wcp_folder_"+folderID).addClass("active");
|
1191 |
+
$("#wcp_folder_"+folderID).find("ul.ui-sortable:first-child > li").slideDown();
|
1192 |
+
folderStatus = 1;
|
1193 |
+
}
|
1194 |
+
ajaxAnimation();
|
1195 |
}
|
|
|
1196 |
}
|
1197 |
+
});
|
1198 |
});
|
1199 |
});
|
1200 |
|
1201 |
$(document).on("keyup", "#folder-search", function(){
|
1202 |
checkForFolderSearch();
|
1203 |
});
|
1204 |
+
|
1205 |
$(document).on("change", "#folder-search", function(){
|
1206 |
checkForFolderSearch();
|
1207 |
});
|
1208 |
+
|
1209 |
$(document).on("blur", "#folder-search", function(){
|
1210 |
checkForFolderSearch();
|
1211 |
});
|
1212 |
+
|
1213 |
$(document).on("click","#folder-hide-show-checkbox",function(){
|
1214 |
if($(this).is(":checked")) {
|
1215 |
+
$("#js-tree-menu").addClass("show-folder-checkbox");
|
1216 |
} else {
|
1217 |
+
$("#js-tree-menu input.checkbox").attr("checked", false);
|
1218 |
+
$("#js-tree-menu").removeClass("show-folder-checkbox");
|
1219 |
}
|
1220 |
});
|
1221 |
|
1222 |
+
$(document).on("click", ".folder-checkbox, .input-checkbox", function(e){
|
1223 |
+
e.stopImmediatePropagation();
|
1224 |
+
e.stopPropagation();
|
1225 |
+
});
|
1226 |
+
|
1227 |
+
$(document).on("click", "#inline-remove", function(){
|
1228 |
+
if($("#js-tree-menu a.jstree-clicked").length) {
|
1229 |
+
fileFolderID = $("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id");
|
1230 |
removeFolderFromID(1);
|
1231 |
$(".dynamic-menu").remove();
|
1232 |
$(".active-menu").removeClass("active-menu");
|
1233 |
} else {
|
1234 |
if($("#folder-hide-show-checkbox").is(":checked")) {
|
|
|
1235 |
$(".dynamic-menu").remove();
|
1236 |
removeFolderFromID(1);
|
1237 |
}
|
1238 |
}
|
1239 |
});
|
1240 |
|
1241 |
+
$(document).on("change", ".folder_for_media", function(){
|
1242 |
+
if($(this).val() == "add-folder") {
|
1243 |
+
isItFromMedia = true;
|
1244 |
+
$("#add-new-folder").trigger("click");
|
1245 |
+
}
|
1246 |
+
});
|
1247 |
});
|
1248 |
|
1249 |
+
function initJSTree() {
|
1250 |
+
$(treeId).jstree({
|
1251 |
+
"core": {
|
1252 |
+
'cache':false,
|
1253 |
+
"animation": 0,
|
1254 |
+
// "check_callback": true,
|
1255 |
+
check_callback: function(e, t, n, r, o) {
|
1256 |
+
$("*").removeClass("drag-bot").removeClass("drag-in").removeClass("drag-up");
|
1257 |
+
if (("move_node" === e || "copy_node" === e) && o && o.dnd)
|
1258 |
+
switch (o.pos) {
|
1259 |
+
case "a":
|
1260 |
+
o.origin.get_node(o.ref, !0).addClass("drag-bot");
|
1261 |
+
nodeId = $(".drag-bot").attr("id");
|
1262 |
+
$("#jstree-dnd").text("Below "+$.trim($("#js-tree-menu").jstree(true).get_node(nodeId).text));
|
1263 |
+
break;
|
1264 |
+
case "i":
|
1265 |
+
o.origin.get_node(o.ref, !0).addClass("drag-in");
|
1266 |
+
nodeId = $(".drag-in").attr("id");
|
1267 |
+
$("#jstree-dnd").text("Inside "+$.trim($("#js-tree-menu").jstree(true).get_node(nodeId).text));
|
1268 |
+
break;
|
1269 |
+
case "b":
|
1270 |
+
o.origin.get_node(o.ref, !0).addClass("drag-up");
|
1271 |
+
nodeId = $(".drag-up").attr("id");
|
1272 |
+
$("#jstree-dnd").text("Above "+$.trim($("#js-tree-menu").jstree(true).get_node(nodeId).text));
|
1273 |
+
break;
|
1274 |
+
default:
|
1275 |
+
$("#jstree-dnd").text($("#jstree-dnd").data("txt"));
|
1276 |
+
break;
|
1277 |
+
}
|
1278 |
+
return !0
|
1279 |
+
}
|
1280 |
+
},
|
1281 |
+
data: {
|
1282 |
+
cache : false
|
1283 |
+
},
|
1284 |
+
select_node: false,
|
1285 |
+
search: {
|
1286 |
+
show_only_matches: true,
|
1287 |
+
case_sensitive: false,
|
1288 |
+
fuzzy: false
|
1289 |
+
},
|
1290 |
+
plugins: ["dnd", "search", "contextmenu"],
|
1291 |
+
contextmenu: {
|
1292 |
+
select_node: 0,
|
1293 |
+
show_at_node: 0,
|
1294 |
+
items: function() {
|
1295 |
+
return {};
|
1296 |
+
}
|
1297 |
+
}
|
1298 |
+
}).bind("ready.jstree", (function() {
|
1299 |
+
setFolderCount();
|
1300 |
+
})).bind("move_node.jstree", (function(t, n) {
|
1301 |
+
folderMoveId = n.node.id;
|
1302 |
+
orderString = "";
|
1303 |
+
$(".jstree-node[id='"+folderMoveId+"']").closest("ul").children().each(function(){
|
1304 |
+
if($(this).attr("id") != 'undefined') {
|
1305 |
+
orderString += $(this).attr("id") + ",";
|
1306 |
+
}
|
1307 |
+
});
|
1308 |
+
if($("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")) {
|
1309 |
+
parentID = $("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().attr("id");
|
1310 |
+
} else {
|
1311 |
+
parentID = 0;
|
1312 |
+
}
|
1313 |
+
if(orderString != "") {
|
1314 |
+
$(".form-loader-count").css("width","100%");
|
1315 |
+
jQuery.ajax({
|
1316 |
+
url: folders_media_options.ajax_url,
|
1317 |
+
data: "term_ids=" + orderString + "&action=wcp_save_folder_order&type=" + folders_media_options.post_type+"&nonce="+folders_media_options.nonce+"&term_id="+folderMoveId+"&parent_id="+parentID,
|
1318 |
+
method: 'post',
|
1319 |
+
success: function (res) {
|
1320 |
+
res = jQuery.parseJSON(res);
|
1321 |
+
if (res.status == '1') {
|
1322 |
+
$("#wcp_folder_parent").html(res.options);
|
1323 |
+
$(".form-loader-count").css("width", "0");
|
1324 |
+
resetMediaAndPosts();
|
1325 |
+
ajaxAnimation();
|
1326 |
+
} else {
|
1327 |
+
$(".folder-popup-form").hide();
|
1328 |
+
$(".folder-popup-form").removeClass("disabled");
|
1329 |
+
$("#error-folder-popup-message").html(res.message);
|
1330 |
+
$("#error-folder-popup").show();
|
1331 |
+
window.location.reload(true);
|
1332 |
+
}
|
1333 |
+
}
|
1334 |
+
});
|
1335 |
+
}
|
1336 |
+
}));
|
1337 |
+
}
|
1338 |
+
|
1339 |
+
function setFolderCount() {
|
1340 |
+
$("#js-tree-menu .jstree-node").each(function(){
|
1341 |
+
var folderCount = parseInt($(this).data("count"));
|
1342 |
+
if(folderCount > 0) {
|
1343 |
+
$(".jstree-node[id='" + $(this).attr("id") + "'] > a span.premio-folder-count").text(folderCount);
|
1344 |
+
}
|
1345 |
+
|
1346 |
+
var folderProperty = {
|
1347 |
+
'folder_id': $(this).attr("id"),
|
1348 |
+
'folder_count': folderCount,
|
1349 |
+
'is_sticky': $(this).hasClass("is-sticky")?1:0,
|
1350 |
+
'is_high': $(this).hasClass("is-high")?1:0,
|
1351 |
+
'nonce': $(this).data("nonce"),
|
1352 |
+
'slug': $(this).data("slug"),
|
1353 |
+
'is_deleted': 0
|
1354 |
+
};
|
1355 |
+
folderPropertyArray.push(folderProperty);
|
1356 |
+
});
|
1357 |
+
|
1358 |
+
if(activeRecordID != "" && activeRecordID != 0) {
|
1359 |
+
if($(".jstree-node[id='"+activeRecordID+"']").length) {
|
1360 |
+
$("#js-tree-menu").jstree('select_node', activeRecordID);
|
1361 |
+
if($(".sticky-folders .sticky-folder-"+activeRecordID+" a").length) {
|
1362 |
+
$(".sticky-folders .sticky-folder-" + activeRecordID + " a").addClass("active-item");
|
1363 |
+
}
|
1364 |
+
}
|
1365 |
+
}
|
1366 |
+
$(".ajax-preloader").hide();
|
1367 |
+
$(".js-tree-data").show();
|
1368 |
+
setCustomScrollForFolder();
|
1369 |
+
make_sticky_folder_menu();
|
1370 |
+
if($(".sticky-folders ul > li").length > 0) {
|
1371 |
+
$(".sticky-folders").addClass("active");
|
1372 |
+
}
|
1373 |
+
}
|
1374 |
+
|
1375 |
+
function getSettingForPost(postId, filedName) {
|
1376 |
+
if(folderPropertyArray.length > 0) {
|
1377 |
+
for(i=0; i<folderPropertyArray.length; i++) {
|
1378 |
+
if(parseInt(folderPropertyArray[i]['folder_id']) == parseInt(postId)) {
|
1379 |
+
return folderPropertyArray[i][filedName];
|
1380 |
+
}
|
1381 |
+
}
|
1382 |
+
}
|
1383 |
+
return "";
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
function getIndexForPostSetting(postId) {
|
1387 |
+
if(folderPropertyArray.length > 0) {
|
1388 |
+
for(i=0; i<folderPropertyArray.length; i++) {
|
1389 |
+
if(parseInt(folderPropertyArray[i]['folder_id']) == parseInt(postId)) {
|
1390 |
+
return i;
|
1391 |
+
}
|
1392 |
+
}
|
1393 |
+
}
|
1394 |
+
return null;
|
1395 |
+
}
|
1396 |
+
|
1397 |
+
function make_sticky_folder_menu() {
|
1398 |
+
$(".sticky-folders > ul").html("");
|
1399 |
+
var stickyMenuHtml = "";
|
1400 |
+
|
1401 |
+
$("#js-tree-menu li.jstree-node.is-sticky").each(function(){
|
1402 |
+
var folder_ID = $(this).attr("id");
|
1403 |
+
var folderName = $.trim($("#js-tree-menu").jstree(true).get_node(folder_ID).text);
|
1404 |
+
var folderCount = $("#"+folder_ID+"_anchor .premio-folder-count").text();
|
1405 |
+
var hasStar = $("li.jstree-node[id='"+folder_ID+"']").hasClass("is-high")?" is-high ":"";
|
1406 |
+
stickyMenuHtml += "<li data-folder-id='"+folder_ID+"' class='sticky-fldr "+hasStar+" sticky-folder-"+folder_ID+"'>" +
|
1407 |
+
"<a href='javascript:;'>" +
|
1408 |
+
"<span class='folder-title'>"+folderName+"</span>" +
|
1409 |
+
"<span class='folder-actions'>" +
|
1410 |
+
"<span class='update-inline-record'><i class='pfolder-edit-folder'></i></span>" +
|
1411 |
+
"<span class='star-icon'><i class='pfolder-star'></i></span>" +
|
1412 |
+
"<span class='premio-folder-count'></span>" +
|
1413 |
+
"</span>"+
|
1414 |
+
"</a>" +
|
1415 |
+
"</li>";
|
1416 |
+
});
|
1417 |
+
$(".sticky-folders > ul").html(stickyMenuHtml);
|
1418 |
+
if($(".jstree-anchor.jstree-clicked").length) {
|
1419 |
+
var activeTermId = $(".jstree-anchor.jstree-clicked").closest("li.jstree-node").attr("id");
|
1420 |
+
$(".sticky-folders .sticky-folder-"+activeTermId+" a").addClass("active-item");
|
1421 |
+
}
|
1422 |
+
|
1423 |
+
if($(".sticky-folders > ul > li").length > 0) {
|
1424 |
+
$(".sticky-folders").addClass("active");
|
1425 |
+
} else {
|
1426 |
+
$(".sticky-folders").removeClass("active");
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
setCustomScrollForFolder();
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
function setCustomScrollForFolder() {
|
1433 |
+
|
1434 |
+
}
|
1435 |
+
|
1436 |
function removeMultipleFolderItems() {
|
1437 |
if($("#folder-hide-show-checkbox").is(":checked")) {
|
1438 |
if($("#custom-menu input.checkbox:checked").length > 0) {
|
1445 |
}
|
1446 |
});
|
1447 |
$(".form-loader-count").css("width", "100%");
|
1448 |
+
$.ajax({
|
1449 |
url: folders_media_options.ajax_url,
|
1450 |
data: "type=" + folders_media_options.post_type + "&action=wcp_remove_muliple_folder&term_id=" + folderIDs+"&nonce="+folders_media_options.nonce,
|
1451 |
method: 'post',
|
1452 |
success: function (res) {
|
1453 |
+
res = $.parseJSON(res);
|
1454 |
$(".form-loader-count").css("width", "0px");
|
1455 |
if (res.status == '1') {
|
1456 |
isKeyActive = parseInt(res.is_key_active);
|
1457 |
n_o_file = parseInt(res.folders);
|
1458 |
$("#current-folder").text(n_o_file);
|
1459 |
+
for(i=0; i<res.term_ids.length; i++) {
|
1460 |
+
$('#js-tree-menu').jstree().delete_node(res.term_ids[i]);
|
1461 |
+
}
|
|
|
1462 |
|
1463 |
$("#ttl-fldr").text((4*2)+(4/2));
|
1464 |
// add_menu_to_list();
|
1466 |
$(".folder-popup-form").hide();
|
1467 |
$(".folder-popup-form").removeClass("disabled");
|
1468 |
resetMediaAndPosts();
|
1469 |
+
make_sticky_folder_menu();
|
1470 |
|
1471 |
ajaxAnimation();
|
1472 |
|
1478 |
window.location.reload();
|
1479 |
}
|
1480 |
$("#folder-hide-show-checkbox").attr("checked", false);
|
1481 |
+
$("#js-tree-menu input.checkbox").attr("checked", false);
|
1482 |
+
$("#js-tree-menu").removeClass("show-folder-checkbox");
|
1483 |
}
|
1484 |
});
|
1485 |
} else {
|
1495 |
$(".select-mode-toggle-button").trigger("click");
|
1496 |
}
|
1497 |
}
|
1498 |
+
if(folderIDs != "" && ($("#js-tree-menu a.jstree-clicked").length > 0 || activeRecordID == "-1")) {
|
1499 |
if($("#media-attachment-taxonomy-filter").length) {
|
1500 |
folderIDs = folderIDs.split(",");
|
1501 |
for (var i = 0; i < folderIDs.length; i++) {
|
1502 |
if(folderIDs[i] != "") {
|
1503 |
+
$(".attachments-browser li[data-id='"+folderIDs[i]+"']").remove();
|
1504 |
}
|
1505 |
}
|
1506 |
}
|
1509 |
if($("#media-attachment-taxonomy-filter").length) {
|
1510 |
resetMediaData(0);
|
1511 |
} else {
|
1512 |
+
$.ajax({
|
1513 |
url: folders_media_options.ajax_url,
|
1514 |
data: "type=" + folders_media_options.post_type + "&action=get_folders_default_list",
|
1515 |
method: 'post',
|
1516 |
success: function (res) {
|
1517 |
+
res = $.parseJSON(res);
|
1518 |
+
// $("#js-tree-menu > ul#space_0").html(res.data);
|
1519 |
$(".header-posts .total-count").text(res.total_items);
|
1520 |
$(".un-categorised-items .total-count").text(res.empty_items);
|
1521 |
|
1524 |
$("#title_"+res.taxonomies[i].term_id+" .star-icon").before("<span class='total-count'></span>");
|
1525 |
}
|
1526 |
$("#title_"+res.taxonomies[i].term_id+" .total-count").text(parseInt(res.taxonomies[i].trash_count));
|
|
|
|
|
|
|
|
|
|
|
1527 |
}
|
1528 |
|
1529 |
+
$("span.premio-folder-count").text("");
|
1530 |
+
$(".folder-count").text("");
|
1531 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
1532 |
+
if(parseInt(res.taxonomies[i].trash_count) != 0) {
|
1533 |
+
$(".jstree-node[id='" + res.taxonomies[i].term_id + "'] > a.jstree-anchor span.premio-folder-count").text(res.taxonomies[i].trash_count);
|
1534 |
+
$(".sticky-folder-"+res.taxonomies[i].term_id+" .premio-folder-count").text(res.taxonomies[i].trash_count);
|
|
|
|
|
|
|
1535 |
}
|
1536 |
+
}
|
1537 |
}
|
1538 |
});
|
1539 |
$(".folder-loader-ajax").addClass("active");
|
1540 |
if($("#folder-posts-filter").length) {
|
1541 |
+
$("#folder-posts-filter").load(folderCurrentURL + " #posts-filter", function(){
|
1542 |
+
var obj = { Title: "", Url: folderCurrentURL };
|
1543 |
+
history.pushState(obj, obj.Title, obj.Url);
|
1544 |
if (folders_media_options.show_in_page == "show" && !$(".tree-structure").length) {
|
1545 |
+
$(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>');
|
1546 |
}
|
|
|
1547 |
triggerInlineUpdate();
|
1548 |
});
|
1549 |
} else {
|
1550 |
$("#wpbody").load(folderCurrentURL + " #wpbody-content", false, function (res) {
|
1551 |
if (folders_media_options.show_in_page == "show" && !$(".tree-structure").length) {
|
1552 |
+
$(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>');
|
1553 |
}
|
|
|
1554 |
});
|
1555 |
}
|
1556 |
}
|
1558 |
|
1559 |
function resetDDCounter() {
|
1560 |
var currentDDVal = $("#media-attachment-taxonomy-filter").val();
|
1561 |
+
resetMediaFlag = jQuery.ajax({
|
1562 |
url: folders_media_options.ajax_url,
|
1563 |
data: "type=attachment&action=wcp_get_default_list&active_id=0",
|
1564 |
method: 'post',
|
1565 |
+
beforeSend: function() {
|
1566 |
+
if(resetMediaFlag != null) {
|
1567 |
+
resetMediaFlag.abort();
|
1568 |
+
}
|
1569 |
+
},
|
1570 |
+
success: function(res) {
|
1571 |
var res = jQuery.parseJSON(res);
|
1572 |
|
1573 |
if($("#media-attachment-taxonomy-filter").length) {
|
1577 |
selectedDD.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>");
|
1578 |
lastFolderData = res.taxonomies;
|
1579 |
for (var i = 0; i < res.taxonomies.length; i++) {
|
1580 |
+
selectedDD.append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].trash_count + ")</option>");
|
1581 |
}
|
1582 |
selectedDD.val(currentDDVal).trigger("change");
|
|
|
|
|
|
|
|
|
1583 |
});
|
1584 |
if($("select.folder_for_media").length) {
|
1585 |
var selectedVal = $("select.folder_for_media").val();
|
1591 |
$(".folder_for_media").val(selectedVal);
|
1592 |
}
|
1593 |
}
|
1594 |
+
$("span.premio-folder-count").text("");
|
1595 |
+
$(".folder-count").text("");
|
1596 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
1597 |
+
if(parseInt(res.taxonomies[i].trash_count) != 0) {
|
1598 |
+
$(".jstree-node[id='" + res.taxonomies[i].term_id + "'] > a.jstree-anchor span.premio-folder-count").text(res.taxonomies[i].trash_count);
|
1599 |
+
$(".sticky-folder-"+res.taxonomies[i].term_id+" .premio-folder-count").text(res.taxonomies[i].trash_count);
|
|
|
|
|
1600 |
}
|
|
|
|
|
|
|
|
|
1601 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1602 |
}
|
1603 |
}
|
1604 |
});
|
1605 |
}
|
1606 |
|
1607 |
function checkForFolderSearch() {
|
1608 |
+
var searchVal = $.trim($("#folder-search").val());
|
1609 |
+
$('#js-tree-menu').jstree('search', searchVal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1610 |
}
|
1611 |
|
1612 |
function removeFolderFromID(popup_type) {
|
1616 |
if(popup_type == 1) {
|
1617 |
if($("#folder-hide-show-checkbox").is(":checked")) {
|
1618 |
isMultipleRemove = true;
|
1619 |
+
if($("#js-tree-menu input.checkbox:checked").length == 0) {
|
1620 |
$(".folder-popup-form").hide();
|
1621 |
$(".folder-popup-form").removeClass("disabled");
|
1622 |
$("#error-folder-popup-message").html("Please select at least one folder to delete");
|
1623 |
$("#error-folder-popup").show();
|
1624 |
return;
|
1625 |
} else {
|
1626 |
+
if($("#js-tree-menu input.checkbox:checked").length > 1) {
|
1627 |
removeMessage = "Are you sure you want to delete the selected folders?";
|
1628 |
removeNotice = "Items in the selected folders will not be deleted.";
|
1629 |
}
|
1640 |
}
|
1641 |
|
1642 |
function updateFolder() {
|
1643 |
+
folderName = $.trim($("#js-tree-menu").jstree(true).get_node(fileFolderID).text);
|
1644 |
+
parentID = $("#wcp_folder_"+fileFolderID).closest("li.jstree-node").data("folder-id");
|
1645 |
if(parentID == undefined) {
|
1646 |
parentID = 0;
|
1647 |
}
|
1648 |
|
|
|
1649 |
$("#update-folder-data").text("Submit");
|
1650 |
$(".folder-form-errors").removeClass("active");
|
1651 |
$("#update-folder-item-name").val(folderName);
|
1652 |
$("#update-folder-item").removeClass("disabled");
|
1653 |
$("#update-folder-item").show();
|
1654 |
$("#update-folder-item-name").focus();
|
1655 |
+
$(".dynamic-menu").remove();
|
1656 |
}
|
1657 |
|
1658 |
function addFolder() {
|
|
|
|
|
1659 |
if(isKeyActive == 0 && n_o_file >= ((4*4)-(3*3)+(4/4)+(8/(2*2)))) {
|
1660 |
$("#folder-limitation-message").html("You've "+"reached the "+((4*4)-(2*2)-2)+" folder limitation!");
|
1661 |
$("#no-more-folder-credit").show();
|
1668 |
$("#add-update-folder-name").val("");
|
1669 |
if(isDuplicate) {
|
1670 |
duplicateFolderId = fileFolderID;
|
1671 |
+
$("#add-update-folder-name").val($.trim($("#js-tree-menu").jstree(true).get_node(fileFolderID).text)+ " #2");
|
1672 |
+
if($("#"+fileFolderID+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")) {
|
1673 |
+
fileFolderID = $("#"+fileFolderID+"_anchor").closest(".jstree-node").parent().parent().attr("id");
|
1674 |
} else {
|
1675 |
+
fileFolderID = 0;
|
1676 |
}
|
1677 |
}
|
1678 |
|
|
|
|
|
|
|
1679 |
$("#add-update-folder").removeClass("disabled");
|
1680 |
$("#add-update-folder").show();
|
1681 |
$("#add-update-folder-name").focus();
|
1682 |
+
$(".dynamic-menu").remove();
|
1683 |
}
|
1684 |
|
1685 |
function checkForExpandCollapse() {
|
1686 |
+
setTimeout(function(){
|
1687 |
+
var currentStatus = true;
|
1688 |
+
if($("#js-tree-menu .jstree-node.jstree-leaf").length == $("#js-tree-menu .jstree-node").length) {
|
1689 |
+
$("#expand-collapse-list").removeClass("all-open");
|
1690 |
+
$("#expand-collapse-list").attr("data-folder-tooltip","Expand");
|
1691 |
+
} else {
|
1692 |
+
var totalChild = $("#js-tree-menu .jstree-node.jstree-closed").length + $("#js-tree-menu .jstree-node.jstree-open").length;
|
1693 |
+
if($("#js-tree-menu .jstree-node.jstree-closed").length == totalChild) {
|
1694 |
+
$("#expand-collapse-list").removeClass("all-open");
|
1695 |
+
$("#expand-collapse-list").attr("data-folder-tooltip","Expand");
|
1696 |
+
} else {
|
1697 |
+
$("#expand-collapse-list").addClass("all-open");
|
1698 |
+
$("#expand-collapse-list").attr("data-folder-tooltip","Collapse");
|
1699 |
+
}
|
1700 |
+
}
|
1701 |
+
}, 500);
|
1702 |
}
|
1703 |
|
1704 |
+
var resetMediaFlag;
|
1705 |
function resetMediaData(loadData) {
|
1706 |
+
resetMediaFlag = $.ajax({
|
1707 |
url: folders_media_options.ajax_url,
|
1708 |
data: "type=" + folders_media_options.post_type + "&action=wcp_get_default_list&active_id="+activeRecordID,
|
1709 |
method: 'post',
|
1710 |
+
beforeSend: function() {
|
1711 |
+
console.log("changed");
|
1712 |
+
if(resetMediaFlag != null) {
|
1713 |
+
resetMediaFlag.abort();
|
1714 |
+
}
|
1715 |
+
},
|
1716 |
success: function (res) {
|
1717 |
+
res = $.parseJSON(res);
|
1718 |
+
// $("#js-tree-menu > ul#space_0").html(res.data);
|
1719 |
$(".header-posts .total-count").text(res.total_items);
|
1720 |
$(".un-categorised-items .total-count").text(res.empty_items);
|
1721 |
+
selectedVal = $("#media-attachment-taxonomy-filter").val();
|
1722 |
+
if(selectedVal != "all" && loadData == 1) {
|
1723 |
var wp1 = parent.wp;
|
1724 |
if(wp1.media != undefined) {
|
1725 |
wp1.media.frame.setState('insert');
|
1735 |
if($("#media-attachment-taxonomy-filter").length) {
|
1736 |
folders_media_options.terms = res.taxonomies;
|
1737 |
var selectedDD = $("#media-attachment-taxonomy-filter");
|
1738 |
+
selectedDD.html("<option value='all'>All Folders</option><option value='all'>(Unassigned)</option>");
|
1739 |
$(".media-select-folder").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>");
|
1740 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
1741 |
selectedDD.append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].trash_count + ")</option>");
|
1742 |
$(".media-select-folder").append("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name + " (" + res.taxonomies[i].trash_count + ")</option>");
|
|
|
|
|
|
|
1743 |
}
|
1744 |
selectedDD.val(selectedVal);
|
1745 |
$(".media-select-folder").val("");
|
1747 |
if($("select.folder_for_media").length) {
|
1748 |
selectedVal = $("select.folder_for_media").val();
|
1749 |
$("select.folder_for_media option:not(:first-child):not(:last-child)").remove();
|
1750 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
1751 |
$("select.folder_for_media option:last-child").before("<option value='" + res.taxonomies[i].term_id + "'>" + res.taxonomies[i].name +"</option>");
|
1752 |
}
|
1753 |
if(selectedVal != "") {
|
1754 |
$(".folder_for_media").val(selectedVal);
|
1755 |
}
|
1756 |
}
|
1757 |
+
$("span.premio-folder-count").text("");
|
1758 |
+
for (i = 0; i < res.taxonomies.length; i++) {
|
1759 |
+
if(parseInt(res.taxonomies[i].trash_count) != 0) {
|
1760 |
+
$(".jstree-node[id='" + res.taxonomies[i].term_id + "'] > a.jstree-anchor span.premio-folder-count").text(res.taxonomies[i].trash_count);
|
1761 |
+
$(".sticky-folder-"+res.taxonomies[i].term_id+" .premio-folder-count").text(res.taxonomies[i].trash_count);
|
|
|
|
|
|
|
1762 |
}
|
|
|
|
|
|
|
|
|
1763 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1764 |
}
|
1765 |
+
|
1766 |
if(activeRecordID != "") {
|
1767 |
$("#wcp_folder_"+activeRecordID).addClass("active-item");
|
1768 |
}
|
1775 |
});
|
1776 |
}
|
1777 |
|
1778 |
+
function set_default_folders(post_id) {
|
1779 |
+
jQuery.ajax({
|
1780 |
+
url: folders_media_options.ajax_url,
|
1781 |
+
type: 'post',
|
1782 |
+
data: 'action=save_folder_last_status&post_type='+folders_media_options.post_type+"&post_id="+post_id+"&nonce="+folders_media_options.nonce,
|
1783 |
+
cache: false,
|
1784 |
+
async: false,
|
1785 |
+
success: function(){
|
1786 |
+
|
1787 |
+
}
|
1788 |
+
})
|
1789 |
+
}
|
1790 |
+
|
1791 |
function ajaxAnimation() {
|
1792 |
$(".folder-loader-ajax").addClass("active");
|
1793 |
$(".folder-loader-ajax img").removeClass("active");
|
1798 |
$(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated");
|
1799 |
}, 2000);
|
1800 |
}
|
1801 |
+
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/page-post-media.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){"use strict";var o=-1,a=0,s=0,i="",r=-1,l="",d=folders_media_options.page_url,n="",c="",m=!1,p=!1,f=!1,u=0,h=0,v=wp.media.view.AttachmentFilters.extend({id:"media-attachment-taxonomy-filter",createFilters:function(){var e={};folders_media_options.terms.length;_.each(folders_media_options.terms||{},function(t,o){e[t.term_id]={text:t.name+" ("+t.count+")",props:{media_folder:t.slug}}}),e.all={text:"All Folders",props:{media_folder:""},priority:10},e.unassigned={text:"(Unassigned)",props:{media_folder:"-1"},priority:10},this.filters=e},change:function(){var e={};_.each(folders_media_options.terms||{},function(t,o){e[t.term_id]={text:t.name+" ("+t.count+")",props:{media_folder:t.slug}}}),e.all={text:"Select a folder >>",props:{media_folder:""},priority:10},e.unassigned={text:"(Unassigned)",props:{media_folder:"-1"},priority:10},this.filters=e;var t=this.filters[this.el.value];t&&this.model.set(t.props)}}),g=(o=-1,0),x=0,y=wp.media.view.AttachmentsBrowser;wp.media.view.AttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({createToolbar:function(){y.prototype.createToolbar.call(this),this.toolbar.set("MediaLibraryOrganizerTaxonomyFilter",new v({controller:this.controller,model:this.collection.props,priority:-75}).render())}});var w,b=wp.media.model.Query;_.extend(b,{get:(w=[],function(e,t){var o,a={},s=b.orderby,i=b.defaultProps;return delete e.query,delete e.cache,_.defaults(e,i),_.each(["include","exclude"],function(t){e[t]&&!_.isArray(e[t])&&(e[t]=[e[t]])}),_.each(e,function(e,t){_.isNull(e)||(a[b.propmap[t]||t]=e)}),_.defaults(a,b.defaultArgs),a.orderby=s.valuemap[e.orderby]||e.orderby,w=[],o||(o=new b([],_.extend(t||{},{props:e,args:a})),w.push(o)),o})});var C=window.wp;void 0!==C&&"function"==typeof C.Uploader&&(C.media.view.Modal.prototype.on("open",function(){setTimeout(function(){t("#media-attachment-taxonomy-filter").length&&("all"==t("#media-attachment-taxonomy-filter").val()&&(t("#media-attachment-taxonomy-filter option:gt(1)").remove(),_.each(folders_media_options.terms,function(e,o){t("#media-attachment-taxonomy-filter").append("<option value='"+e.term_id+"'>"+e.name+" ("+e.count+")</option>")})),jQuery("#wcp-content").length||jQuery(".editor-post-featured-image").length&&jQuery(".attachment-filters").val("all").trigger("change"))},100)}),jQuery.extend(C.Uploader.prototype,{progress:function(){},init:function(){this.uploader&&(this.uploader.bind("FileFiltered",function(e,o){g++,t(".folder-meter").css("width","0%"),t(".media-folder-loader").show(),t("#total_upload_files").text(g)}),this.uploader.bind("BeforeUpload",function(e,a){var s=o,i=e.settings.multipart_params;if((s=parseInt(s))>0&&(i.folder_for_media=s),x<g){t(".media-folder-loader").show();var r=x/g*100;t(".folder-meter").css("width",r+"%")}x++,t("#current_upload_files").text(x)}),this.uploader.bind("UploadComplete",function(e,t){o=-1}),this.uploader.bind("UploadComplete",function(e,o){var a=window.wp;t(".folder-meter").css("width","100%"),setTimeout(function(){t(".media-folder-loader").hide(),t(".folder-meter").css("width","0%"),g=0,x=0},1250),S(),void 0!==a.media.frame&&null!==a.media.frame.content.get()?(a.media.frame.content.get().collection.props.set({ignore:+new Date}),a.media.frame.content.get().options.selection.reset()):t("#media-attachment-taxonomy-filter").length&&t(".attachment-filters").each(function(){t(this).trigger("change")})}))}}));var k=window.wp;if(void 0!==k&&"function"==typeof k.Uploader){var j=window.wp.media,Q=j.view.Modal;j.view.Modal=j.view.Modal.extend({className:"folder-modal",initialize:function(){Q.prototype.initialize.apply(this,arguments)},open:function(){t(".folder-modal").removeClass("folder-modal"),Q.prototype.open.apply(this,arguments)&&(console.log("media frame open"),t(".folder-modal").length&&(t(".folder-custom-menu").remove(),t(".folder-modal .media-frame-tab-panel").removeClass("has-folder-menu"),t(".folder-modal .media-frame").hasClass("hide-menu")?t(".folder-custom-menu").length||(t(".folder-modal .media-frame-tab-panel").before("<div class='folder-custom-menu'><div class='folder-menu-content'></div></div>"),t(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url+" #wcp-content-resize",function(){D()})):t(".folder-custom-menu").length||(t(".folder-modal .media-frame-menu").addClass("has-folder-menu"),t(".folder-modal .media-frame-menu .media-menu").append("<div class='folder-custom-menu'><div class='folder-menu-content'></div></div>"),t(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url+" #wcp-content-resize",function(){D()})),t(".folder-form-data").remove(),t(".media-frame-tab-panel:first").before("<div class='folder-form-data'></div>"),t(".folder-form-data").load(folders_media_options.media_page_url+" #folder-add-update-content",function(){})))},close:function(){Q.prototype.close.apply(this,arguments),t(".folder-modal").removeClass("folder-modal")}})}function I(){if(t(".media-toolbar").hasClass("media-toolbar-mode-select")&&t("ul.attachments li.selected").length&&(t("ul.attachments li.selected").trigger("click"),t(".select-mode-toggle-button").trigger("click")),""!=c&&(t("#custom-menu li.active-item").length>0||"-1"==n)){if(t("#media-attachment-taxonomy-filter").length){c=c.split(",");for(var e=0;e<c.length;e++)""!=c[e]&&t(".media-frame:not(.hide-router) .attachments-browser li[data-id='"+c[e]+"']").remove()}c=""}t("#media-attachment-taxonomy-filter").length?J(0):(jQuery.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=get_folders_default_list",method:"post",success:function(o){o=jQuery.parseJSON(o);for(t(".header-posts .total-count").text(o.total_items),t(".un-categorised-items .total-count").text(o.empty_items),e=0;e<o.taxonomies.length;e++)t("#title_"+o.taxonomies[e].term_id+" .total-count").length||t("#title_"+o.taxonomies[e].term_id+" .star-icon").before("<span class='total-count'></span>"),t("#title_"+o.taxonomies[e].term_id+" .total-count").text(parseInt(o.taxonomies[e].trash_count)),t(".sticky-folders .sticky-folder-"+o.taxonomies[e].term_id+" .folder-count").length||t(".sticky-folders .sticky-folder-"+o.taxonomies[e].term_id+" a").append("<span class='folder-count'></span>"),t(".sticky-folders .sticky-folder-"+o.taxonomies[e].term_id+" .folder-count").text(parseInt(o.taxonomies[e].trash_count));t("#custom-menu .total-count").each(function(){0==parseInt(t(this).text())&&t(this).remove()}),t(".sticky-folders .folder-count").each(function(){0==parseInt(t(this).text())&&t(this).remove()})}}),t(".folder-loader-ajax").addClass("active"),t("#folder-posts-filter").length?t("#folder-posts-filter").load(d+" #posts-filter",function(){"show"!=folders_media_options.show_in_page||t(".tree-structure").length||t(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),add_active_item_to_list(),triggerInlineUpdate()}):t("#wpbody").load(d+" #wpbody-content",!1,function(e){"show"!=folders_media_options.show_in_page||t(".tree-structure").length||t(".wp-header-end").before('<div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div>'),add_active_item_to_list()}))}function S(){var e=t("#media-attachment-taxonomy-filter").val();jQuery.ajax({url:folders_media_options.ajax_url,data:"type=attachment&action=wcp_get_default_list&active_id=0",method:"post",success:function(o){o=jQuery.parseJSON(o);if(t("#media-attachment-taxonomy-filter").length){if(t("#media-attachment-taxonomy-filter").each(function(){folders_media_options.terms=o.taxonomies;var a=t(this);a.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>"),o.taxonomies;for(var s=0;s<o.taxonomies.length;s++)a.append("<option value='"+o.taxonomies[s].term_id+"'>"+o.taxonomies[s].name+" ("+o.taxonomies[s].count+")</option>");a.val(e).trigger("change")}),t("select.folder_for_media").length){var a=t("select.folder_for_media").val();t("select.folder_for_media option:not(:first-child):not(:last-child)").remove();for(var s=0;s<o.taxonomies.length;s++)t("select.folder_for_media option:last-child").before("<option value='"+o.taxonomies[s].term_id+"'>"+o.taxonomies[s].name+"</option>");""!=a&&t(".folder_for_media").val(a)}for(s=0;s<o.taxonomies.length;s++)t("#title_"+o.taxonomies[s].term_id+" .total-count").length||t("#title_"+o.taxonomies[s].term_id+" .star-icon").before("<span class='total-count'></span>"),t("#title_"+o.taxonomies[s].term_id+" .total-count").text(parseInt(o.taxonomies[s].trash_count)),t(".sticky-folders .sticky-folder-"+o.taxonomies[s].term_id+" .folder-count").length||t(".sticky-folders .sticky-folder-"+o.taxonomies[s].term_id+" a").append("<span class='folder-count'></span>"),t(".sticky-folders .sticky-folder-"+o.taxonomies[s].term_id+" .folder-count").text(parseInt(o.taxonomies[s].trash_count)),t("#title_"+o.taxonomies[s].term_id).attr("title",o.taxonomies[s].term_name),t("#title_"+o.taxonomies[s].term_id+" .title-text").html(o.taxonomies[s].term_name);t("#custom-menu .total-count").each(function(){0==parseInt(t(this).text())&&t(this).remove()}),t(".sticky-folders .folder-count").each(function(){0==parseInt(t(this).text())&&t(this).remove()})}}})}function N(){if(""!=t.trim(t("#folder-search").val())){t("#custom-menu").addClass("has-filter");var e=t.trim(t("#folder-search").val()).toLowerCase();t("#custom-menu span.title-text").removeClass("has-search-text"),t("li.route").removeClass("has-search"),t("#custom-menu span.title-text").each(function(){-1!==t(this).text().toLowerCase().indexOf(e)&&(t(this).addClass("has-search-text"),t(this).parents("li.route").addClass("has-search"))})}else t("#custom-menu").removeClass("has-filter"),t("#custom-menu span.title-text").removeClass("has-search-text"),t("li.route").removeClass("has-search")}function P(e){var o="Are you sure you want to delete the selected folder?",a="Items in the folder will not be deleted.";if(m=!1,1==e&&t("#folder-hide-show-checkbox").is(":checked")){if(m=!0,0==t("#custom-menu input.checkbox:checked").length)return t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html("Please select at least one folder to delete"),void t("#error-folder-popup").show();t("#custom-menu input.checkbox:checked").length>1&&(o="Are you sure you want to delete the selected folders?",a="Items in the selected folders will not be deleted.")}t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#remove-folder-item").text("Yes, Delete it!"),t("#remove-folder-message").text(o),t("#remove-folder-notice").text(a),t("#confirm-remove-folder").show(),t("#remove-folder-item").focus()}function A(){var e=t.trim(t("#wcp_folder_"+s+" > h3 > .title-text").text()),o=t("#wcp_folder_"+s).closest("li.route").data("folder-id");null==o&&(o=0),t(".dynamic-menu").hide(),t("#update-folder-data").text("Submit"),t(".folder-form-errors").removeClass("active"),t("#update-folder-item-name").val(e),t("#update-folder-item").removeClass("disabled"),t("#update-folder-item").show(),t("#update-folder-item-name").focus()}function O(){if(0==parseInt(folders_media_options.is_key_active)&&r>=10)return t("#folder-limitation-message").html("You've reached the 10 folder limitation!"),t("#no-more-folder-credit").show(),!1;t("#add-update-folder-title").text("Add new folder"),t("#save-folder-data").text("Submit"),t(".folder-form-errors").removeClass("active"),t("#add-update-folder-name").val(""),f&&(u=s,t("#add-update-folder-name").val(t("#title_"+s+" .title-text").text()+" #2"),s=t("li#wcp_folder_"+s).parent().hasClass("first-space")?0:t("li#wcp_folder_"+s).parent().parent().data("folder-id")),h=t("#space_"+s+" > li").length+1,folders_media_options.ajax_url+"?parent_id="+s+"&type="+folders_media_options.post_type+"&action=wcp_add_new_folder&nonce="+folders_media_options.nonce+"&term_id="+s+"&order="+h+"&name=",t("#add-update-folder").removeClass("disabled"),t("#add-update-folder").show(),t("#add-update-folder-name").focus()}function D(){t("#custom-menu .has-sub-tree").length==t("#custom-menu .has-sub-tree.active").length&&t("#custom-menu .has-sub-tree").length?(t("#expand-collapse-list").addClass("all-open"),t("#expand-collapse-list").attr("data-folder-tooltip","Collapse")):(t("#expand-collapse-list").removeClass("all-open"),t("#expand-collapse-list").attr("data-folder-tooltip","Expand"))}function J(e){jQuery.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_get_default_list&active_id="+n,method:"post",success:function(e){e=jQuery.parseJSON(e),t(".header-posts .total-count").text(e.total_items),t(".un-categorised-items .total-count").text(e.empty_items);var o=t("#media-attachment-taxonomy-filter").val();if("all"!=o){var a=parent.wp;null!=a.media&&(a.media.frame.setState("insert"),null!==a.media.frame.content.get()?(a.media.frame.content.get().collection.props.set({ignore:+new Date}),a.media.frame.content.get().options.selection.reset()):a.media.frame.library.props.set({ignore:+new Date}))}if(e.taxonomies.length){if(t("#media-attachment-taxonomy-filter").length){folders_media_options.terms=e.taxonomies;var i=t("#media-attachment-taxonomy-filter");i.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>"),t(".media-select-folder").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>");for(var r=0;r<e.taxonomies.length;r++)i.append("<option value='"+e.taxonomies[r].term_id+"'>"+e.taxonomies[r].name+" ("+e.taxonomies[r].trash_count+")</option>"),t(".media-select-folder").append("<option value='"+e.taxonomies[r].term_id+"'>"+e.taxonomies[r].name+" ("+e.taxonomies[r].trash_count+")</option>"),t("#title_"+e.taxonomies[r].term_id).attr("title",e.taxonomies[r].term_name),t("#title_"+e.taxonomies[r].term_id+" .title-text").html(e.taxonomies[r].term_name);i.val(o),t(".media-select-folder").val("")}if(t("select.folder_for_media").length){o=t("select.folder_for_media").val(),t("select.folder_for_media option:not(:first-child):not(:last-child)").remove();for(r=0;r<e.taxonomies.length;r++)t("select.folder_for_media option:last-child").before("<option value='"+e.taxonomies[r].term_id+"'>"+e.taxonomies[r].name+"</option>");""!=o&&t(".folder_for_media").val(o)}for(r=0;r<e.taxonomies.length;r++)t("#title_"+e.taxonomies[r].term_id+" .total-count").length||t("#title_"+e.taxonomies[r].term_id+" .star-icon").before("<span class='total-count'></span>"),t("#title_"+e.taxonomies[r].term_id+" .total-count").text(parseInt(e.taxonomies[r].trash_count)),t(".sticky-folders .sticky-folder-"+e.taxonomies[r].term_id+" .folder-count").length||t(".sticky-folders .sticky-folder-"+e.taxonomies[r].term_id+" a").append("<span class='folder-count'></span>"),t(".sticky-folders .sticky-folder-"+e.taxonomies[r].term_id+" .folder-count").text(parseInt(e.taxonomies[r].trash_count)),t("#title_"+e.taxonomies[r].term_id).attr("title",e.taxonomies[r].term_name),t("#title_"+e.taxonomies[r].term_id+" .title-text").html(e.taxonomies[r].term_name);t("#custom-menu .total-count").each(function(){0==parseInt(t(this).text())&&t(this).remove()}),t(".sticky-folders .folder-count").each(function(){0==parseInt(t(this).text())&&t(this).remove()})}""!=n&&t("#wcp_folder_"+n).addClass("active-item"),p&&(t("#title_"+s).trigger("click"),p=!1)}})}function F(){t(".folder-loader-ajax").addClass("active"),t(".folder-loader-ajax img").removeClass("active"),t(".folder-loader-ajax svg#successAnimation").addClass("active").addClass("animated"),setTimeout(function(){t(".folder-loader-ajax").removeClass("active"),t(".folder-loader-ajax img").addClass("active"),t(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated")},2e3)}t(document).ready(function(){parseInt(folders_media_options.is_key_active),r=parseInt(folders_media_options.folders),t(document).on("click",".header-posts a.all-posts",function(e){s=0,n="",t(".active-item").removeClass("active-item"),t(this).addClass("active-item"),t(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("all").trigger("change"),t(this).closest(".media-frame").find(".folder_for_media").val("all").trigger("change")}),t(document).on("click",".un-categorised-items",function(e){s=0,n="",t(".active-item").removeClass("active-item"),t(this).addClass("active-item"),t(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("unassigned").trigger("change"),t(this).closest(".media-frame").find(".folder_for_media").val("-1").trigger("change")}),t(document).on("click","h3.title",function(e){s=t(this).closest("li.route").data("folder-id"),n=s,t(".active-item").removeClass("active-item"),t(this).closest("li.route").addClass("active-item"),t(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val(s).trigger("change"),t(this).closest(".media-frame").find(".folder_for_media").val(s).trigger("change")}),t(document).on("change",".folder_for_media",function(){"add-folder"!=t(this).val()&&null!=t(this).val()?o=t(this).val():"add-folder"==t(this).val()&&(o=-1)}),t(document).on("click",".update-inline-record",function(e){e.stopPropagation();var o=t(this).closest("li.route").hasClass("is-high");t(".dynamic-menu").remove(),t(".active-menu").removeClass("active-menu");var a="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(o?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",s=parseInt(t(this).closest("li.route").find("h3.title:first > .total-count").text());"attachment"==folders_media_options.post_type&&s&&(a+="<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),a+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",t(this).closest("h3.title").after(a),t(this).parents("li.route").addClass("active-menu"),t(this).closest("h3.title").offset().top+t(".dynamic-menu").height()>t(window).height()-20&&(t(".dynamic-menu").addClass("bottom-fix"),t(".dynamic-menu.bottom-fix").offset().top<t("#custom-scroll-menu").offset().top&&t(".dynamic-menu").removeClass("bottom-fix"))}),t(document).on("click","body, html",function(e){t(".dynamic-menu").remove(),t(".active-menu").removeClass("active-menu"),t(".folder-order").removeClass("active")}),t(document).on("click",".dynamic-menu, .folder-order",function(e){e.stopPropagation()}),t(document).on("contextmenu","h3.title",function(){if(e.preventDefault(),0==folders_media_options.can_manage_folder)return!1;var o=t(this).closest("li.route").hasClass("is-high");t(".dynamic-menu").remove(),t(".active-menu").removeClass("active-menu");var a="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(o?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",s=parseInt(t(this).closest("li.route").find("h3.title:first > .total-count").text());return"attachment"==folders_media_options.post_type&&s&&(a+="<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),a+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",t(this).after(a),t(this).parents("li.route").addClass("active-menu"),t(this).offset().top+t(".dynamic-menu").height()>t(window).height()-20&&(t(".dynamic-menu").addClass("bottom-fix"),t(".dynamic-menu.bottom-fix").offset().top<t("#custom-scroll-menu").offset().top&&t(".dynamic-menu").removeClass("bottom-fix")),!1}),t(document).on("click",".new-folder",function(e){e.stopPropagation(),t(".active-menu").removeClass("active-menu"),s=t(this).closest("li.route").data("folder-id"),t(".dynamic-menu").remove(),t(".active-menu").removeClass("active-menu"),p=!1,f=!1,O()}),t(document).on("click","#add-new-folder",function(e){s=t("#custom-menu li.active-item").length?t("#custom-menu li.active-item").data("folder-id"):0,p=!1,O()}),t(document).on("submit","#save-folder-form",function(e){if(e.stopPropagation(),e.preventDefault(),i=t("#add-update-folder-name").val(),""==t.trim(i))t(".folder-form-errors").addClass("active"),t("#add-update-folder-name").focus();else{t("#save-folder-data").html('<span class="dashicons dashicons-update"></span>'),t("#add-update-folder").addClass("disabled");var o="parent_id="+s+"&type="+folders_media_options.post_type+"&action=wcp_add_new_folder&nonce="+folders_media_options.nonce+"&term_id="+s+"&order="+h+"&name="+i+"&is_duplicate="+f+"&duplicate_from="+u;p&&(o="parent_id=0&type="+folders_media_options.post_type+"&action=wcp_add_new_folder&nonce="+folders_media_options.nonce+"&term_id=0&order="+h+"&name="+i+"&is_duplicate="+f+"&duplicate_from="+u),jQuery.ajax({url:folders_media_options.ajax_url,data:o,method:"post",success:function(e){var o=jQuery.parseJSON(e);"1"==o.status?(t("#space_"+o.parent_id).append(o.term_data),t("#wcp_folder_"+o.parent_id).addClass("active has-sub-tree"),parseInt(o.is_key_active),r=parseInt(o.folders),t("#current-folder").text(r),t("#ttl-fldr").text(10),D(),t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),F(),s=o.term_id,J(0)):(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(o.message),t("#error-folder-popup").show())}})}return!1}),t(document).on("click",".form-cancel-btn",function(){t(".folder-popup-form").hide()}),t(document).on("click",".folder-popup-form",function(e){t(".folder-popup-form").hide()}),t(document).on("click",".popup-form-content",function(e){e.stopPropagation()}),document.onkeydown=function(e){("key"in(e=e||window.event)?"Escape"===e.key||"Esc"===e.key:27===e.keyCode)&&t(".folder-popup-form").hide()},t(document).on("click",".rename-folder",function(e){e.stopPropagation(),s=t(this).closest("li.route").data("folder-id"),A()}),t(document).on("click","#inline-update",function(e){t("#custom-menu li.active-item").length&&(s=t("#custom-menu li.active-item").data("folder-id"),A())}),t(document).on("submit","#update-folder-form",function(e){if(e.stopPropagation(),e.preventDefault(),t(".dynamic-menu").hide(),i=t("#update-folder-item-name").val(),""==t.trim(i))t(".folder-form-errors").addClass("active"),t("#update-folder-item-name").focus();else{t("#update-folder-data").html('<span class="dashicons dashicons-update"></span>'),t("#update-folder-item").addClass("disabled"),l=t.trim(t("#wcp_folder_"+s).data("rename"));var o=t("#wcp_folder_"+s).closest("li.route").data("folder-id");null==o&&(o=0),jQuery.ajax({url:folders_media_options.ajax_url,data:"parent_id="+o+"&nonce="+l+"&type="+folders_media_options.post_type+"&action=wcp_update_folder&term_id="+s+"&name="+i,method:"post",success:function(e){var o=jQuery.parseJSON(e);"1"==o.status?(t("#wcp_folder_"+o.id+" > h3 > .title-text").text(o.term_title),t("#wcp_folder_"+o.id+" > h3").attr("title",o.term_title),t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),F(),J(0)):(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(o.message),t("#error-folder-popup").show())}})}return!1}),t(document).on("click",".mark-folder",function(e){e.stopPropagation(),a=t(this).closest("li.route").data("folder-id"),l=t.trim(t("#wcp_folder_"+a).data("star")),t(".form-loader-count").css("width","100%"),t(".dynamic-menu").remove(),t(".active-menu").removeClass("active-menu"),jQuery.ajax({url:folders_media_options.ajax_url,data:"term_id="+a+"&type="+folders_media_options.post_type+"&action=wcp_mark_un_mark_folder&nonce="+l,method:"post",cache:!1,success:function(e){e=jQuery.parseJSON(e);t(".form-loader-count").css("width","0%"),"1"==e.status?("1"==e.marked?t("#wcp_folder_"+e.id).addClass("is-high"):t("#wcp_folder_"+e.id).removeClass("is-high"),F()):(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(e.message),t("#error-folder-popup").show())}})}),t(document).on("click",".duplicate-folder",function(e){e.stopPropagation(),t(".active-menu").removeClass("active-menu"),s=t(this).closest("li.route").data("folder-id"),t(".dynamic-menu").remove(),f=!0,O()}),t(document).on("click",".remove-folder",function(e){a=t(this).closest("li.route").data("folder-id"),s=a,P(0),t(".dynamic-menu").remove(),t(".active-menu").removeClass("active-menu")}),t(document).on("click","#remove-folder-item",function(e){e.stopPropagation(),t(".folder-popup-form").addClass("disabled"),t("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>'),l=t.trim(t("#wcp_folder_"+s).data("delete")),m?function(){if(t("#folder-hide-show-checkbox").is(":checked")&&t("#custom-menu input.checkbox:checked").length>0){var e="";t("#custom-menu input.checkbox:checked").each(function(){e+=t(this).val()+",",t(this).closest("li.route").hasClass("active-item")&&!0}),t(".form-loader-count").css("width","100%"),jQuery.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_remove_muliple_folder&term_id="+e+"&nonce="+folders_media_options.nonce,method:"post",success:function(e){var e=jQuery.parseJSON(e);t(".form-loader-count").css("width","0px"),"1"==e.status?(parseInt(e.is_key_active),r=parseInt(e.folders),t("#current-folder").text(r),t("#custom-menu input.checkbox:checked").each(function(){t("#wcp_folder_"+t(this).val()).closest("li.route").remove(),t("#space"+t(this).val()).remove()}),t("#ttl-fldr").text(10),F(),t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),I(),F(),t("#wcp_folder_"+n).length||(t(".header-posts a").trigger("click"),n=0)):window.location.reload(),t("#folder-hide-show-checkbox").attr("checked",!1),t("#custom-menu input.checkbox").attr("checked",!1),t("#custom-menu").removeClass("show-folder-checkbox")}})}}():jQuery.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_remove_folder&term_id="+s+"&nonce="+l,method:"post",success:function(e){"1"==(e=jQuery.parseJSON(e)).status?(t("#wcp_folder_"+s).remove(),t("#folder_"+s).remove(),parseInt(e.is_key_active),r=parseInt(e.folders),t("#current-folder").text(r),t("#ttl-fldr").text(10),F(),t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),n==s&&jQuery(".header-posts a").trigger("click"),S()):(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(e.message),t("#error-folder-popup").show())}})}),t(document).on("click","#sort-order-list",function(e){e.stopPropagation(),t(".folder-order").toggleClass("active")}),t(document).on("click","#expand-collapse-list",function(e){e.stopPropagation();var o=0;t(this).hasClass("all-open")?(t(this).removeClass("all-open"),t(".has-sub-tree").removeClass("active"),o=0,t(this).attr("data-folder-tooltip","Expand")):(t(this).addClass("all-open"),o=1,t(".has-sub-tree").addClass("active"),t(this).attr("data-folder-tooltip","Collapse")),c="",t(".has-sub-tree").each(function(){c+=t(this).data("folder-id")+","}),""!=c&&(t(".form-loader-count").css("width","100%"),l=folders_media_options.nonce,jQuery.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_change_all_status&status="+o+"&folders="+c+"&nonce="+l,method:"post",success:function(e){t(".form-loader-count").css("width","0"),"0"==(e=jQuery.parseJSON(e)).status&&(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(e.message),t("#error-folder-popup").show(),window.location.reload(!0))}}))}),t(document).on("click",".folder-sort-menu a",function(e){e.stopPropagation(),e.preventDefault(),t(".form-loader-count").css("width","100%"),t(".folder-order").removeClass("active"),t(this).attr("data-sort"),jQuery.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_folders_by_order&nonce="+folders_media_options.nonce+"&order="+t(this).attr("data-sort"),method:"post",success:function(e){1==(e=jQuery.parseJSON(e)).status&&t("#space_0").html(e.data),t(".form-loader-count").css("width","0")}})}),t(".space").livequery(function(){t(this).sortable({placeholder:"ui-state-highlight",connectWith:".space",tolerance:"intersect",over:function(e,t){},update:function(e,o){o.item.context.attributes["data-folder-id"].nodeValue;var a="";t(this).children().each(function(){t(this).hasClass("route")&&(a+=t(this).data("folder-id")+",")}),""!=a&&(t(".form-loader-count").css("width","100%"),jQuery.ajax({url:folders_media_options.ajax_url,data:"term_ids="+a+"&action=wcp_save_folder_order&type="+folders_media_options.post_type+"&nonce="+folders_media_options.nonce,method:"post",success:function(e){"1"==(e=jQuery.parseJSON(e)).status?(t("#wcp_folder_parent").html(e.options),t(".form-loader-count").css("width","0"),I(),F()):(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(e.message),t("#error-folder-popup").show(),window.location.reload(!0))}}))},receive:function(e,o){!function e(o){var a=t(o).siblings(".space").children(".route").children(".title");t(a).each(function(a,s){var i=parseInt(t(o).css("width")),r=parseInt(t(o).siblings(".space").css("margin-left")),l=i-r;"title_0"==t(o).attr("id")&&(l-=10),t(s).css({width:l}),e(s)})}(t(this).siblings(".title")),t(this).closest("li.route").addClass("active"),t(this).closest("li.route").find("ul.ui-sortable:first-child > li").slideDown();var a=t(this).closest("li.route").data("folder-id"),s=o.item.context.attributes["data-folder-id"].nodeValue;null==a&&(a=0);t("#wcp_folder_"+a+" .ui-sortable li").length?t("#wcp_folder_"+a+" .ui-sortable li").each(function(){t(this).data("folder-id")+","}):0==a&&t("#custom-menu > ul.space > li").each(function(){t(this).data("folder-id")+","}),t(".form-loader-count").css("width","100%"),l=t.trim(t("#wcp_folder_"+s).data("nonce")),jQuery.ajax({url:folders_media_options.ajax_url,data:"term_id="+s+"&action=wcp_update_parent_information&parent_id="+a+"&type="+folders_media_options.post_type+"&nonce="+l,method:"post",success:function(e){t(".form-loader-count").css("width","0%"),0==(e=jQuery.parseJSON(e)).status?(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(e.message),t("#error-folder-popup").show()):F()}})}}),t(this).disableSelection()}),t("h3.title").livequery(function(){t(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .media-frame:not(.hide-router) .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(e,o){if(a=t(this).closest("li.route").data("folder-id"),o.draggable.hasClass("wcp-move-multiple")){if(t(".wp-list-table input:checked").length){var s="";t(".wp-list-table input:checked").each(function(){s+=t(this).val()+","}),l=t.trim(t("#wcp_folder_"+a).data("nonce")),jQuery.ajax({url:folders_media_options.ajax_url,data:"post_ids="+s+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+a+"&nonce="+l+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+n,method:"post",success:function(e){"1"==(e=jQuery.parseJSON(e)).status?(I(),F()):(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(e.message),t("#error-folder-popup").show())}})}}else if(o.draggable.hasClass("wcp-move-file")){var i=o.draggable[0].attributes["data-id"].nodeValue;l=t.trim(t("#wcp_folder_"+a).data("nonce")),s=i+",",t(".wp-list-table input:checked").each(function(){t(this).val()!=i&&(s+=t(this).val()+",")}),jQuery.ajax({url:folders_media_options.ajax_url,data:"post_ids="+s+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+a+"&nonce="+l+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+n,method:"post",success:function(e){"1"==(e=jQuery.parseJSON(e)).status?(I(),F()):(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(e.message),t("#error-folder-popup").show())}})}else if(o.draggable.hasClass("attachment")){s=o.draggable[0].attributes["data-id"].nodeValue;l=t.trim(t("#wcp_folder_"+a).data("nonce")),t(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").length>1&&(s="",t(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").each(function(){s+=t(this).data("id")+","})),c=s,jQuery.ajax({url:folders_media_options.ajax_url,data:"post_ids="+s+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+a+"&nonce="+l+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+n,method:"post",success:function(e){I(),F()}})}}})}),t(".media-frame:not(.hide-router) .attachments-browser li.attachment").livequery(function(){t(this).draggable({revert:"invalid",containment:"document",helper:function(e,o){t(".selected-items").remove();var a=t(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").length;return t("<div class='selected-items'><span class='total-post-count'>"+(a=0==a||1==a?"1 Item":a+" Items")+" Selected</span></div>")},start:function(e,o){t("body").addClass("no-hover-css")},cursor:"move",appendTo:".media-modal",cursorAt:{left:0,top:0},stop:function(e,o){t(".selected-items").remove(),t("body").removeClass("no-hover-css")}})}),t(".un-categorised-items").livequery(function(){t(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .media-frame:not(.hide-router) .attachments-browser li.attachment",hoverClass:"wcp-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(e,o){if(a=-1,l=folders_media_options.nonce,o.draggable.hasClass("wcp-move-multiple")){if(t(".wp-list-table input:checked").length){var s="";t(".wp-list-table input:checked").each(function(){s+=t(this).val()+","}),jQuery.ajax({url:folders_media_options.ajax_url,data:"post_id="+s+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+a+"&nonce="+l+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+n,method:"post",success:function(e){I(),F()}})}}else if(o.draggable.hasClass("wcp-move-file")){var i=o.draggable[0].attributes["data-id"].nodeValue;s=i+",";t(".wp-list-table input:checked").each(function(){i!=t(this).val()&&(s+=t(this).val()+",")}),jQuery.ajax({url:folders_media_options.ajax_url,data:"post_id="+s+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+a+"&nonce="+l+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+n,method:"post",success:function(e){I(),F()}})}else if(o.draggable.hasClass("attachment")){s=o.draggable[0].attributes["data-id"].nodeValue;t(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").length>1&&(s="",t(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").each(function(){s+=t(this).data("id")+","})),c=s,jQuery.ajax({url:folders_media_options.ajax_url,data:"post_id="+s+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+a+"&nonce="+l+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+n,method:"post",success:function(e){I(),F()}})}}})}),t(".tree-structure .folder-item").livequery(function(){t(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .media-frame:not(.hide-router) .attachments-browser li.attachment",hoverClass:"wcp-drop-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(e,o){if(t("body").removeClass("no-hover-css"),a=t(this).data("id"),o.draggable.hasClass("wcp-move-multiple")){if(l=t.trim(t("#wcp_folder_"+a).data("nonce")),t(".wp-list-table input:checked").length){var s="";t(".wp-list-table input:checked").each(function(){s+=t(this).val()+","}),jQuery.ajax({url:folders_media_options.ajax_url,data:"post_ids="+s+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+a+"&nonce="+l+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+n,method:"post",success:function(e){I(),F()}})}}else if(o.draggable.hasClass("wcp-move-file")){var i=o.draggable[0].attributes["data-id"].nodeValue;l=t.trim(t("#wcp_folder_"+a).data("nonce"));s=i+",";t(".wp-list-table input:checked").each(function(){t(this).val()!=i&&(s+=t(this).val()+",")}),jQuery.ajax({url:folders_media_options.ajax_url,data:"post_ids="+s+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+a+"&nonce="+l+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+n,method:"post",success:function(e){I(),F()}})}else if(o.draggable.hasClass("attachment")){s=o.draggable[0].attributes["data-id"].nodeValue;l=t.trim(t("#wcp_folder_"+a).data("nonce")),t(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").length>1&&(s="",t(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").each(function(){s+=t(this).data("id")+","})),jQuery.ajax({url:folders_media_options.ajax_url,data:"post_ids="+s+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+a+"&nonce="+l+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+n,method:"post",success:function(e){I(),F()}})}}})}),t(".wcp-move-file").livequery(function(){t(this).draggable({revert:"invalid",containment:"document",helper:"clone",cursor:"move",start:function(e,o){t(this).closest("td").addClass("wcp-draggable"),t("body").addClass("no-hover-css")},stop:function(e,o){t(this).closest("td").removeClass("wcp-draggable"),t("body").removeClass("no-hover-css")}})}),t(".wcp-move-multiple").livequery(function(){t(this).draggable({revert:"invalid",containment:"document",helper:function(e,o){t(".selected-items").remove();var a=t("#the-list th input:checked").length;return t(a>0?"<div class='selected-items'><span class='total-post-count'>"+(a=0==a||1==a?"1 Item":a+" Items")+" Selected</span></div>":"<div class='selected-items'><span class='total-post-count'>Select Items to move</span></div>")},start:function(e,o){t("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(e,o){t(".selected-items").remove(),t("body").removeClass("no-hover-css")}})}),t(document).on("click",".nav-icon",function(){a=t(this).closest("li.route").data("folder-id");var e=1;e=t("#wcp_folder_"+a).hasClass("active")?0:1,t(".form-loader-count").css("width","100%"),l=t.trim(t("#wcp_folder_"+a).data("nonce")),D(),jQuery.ajax({url:folders_media_options.ajax_url,data:"is_active="+e+"&action=save_wcp_folder_state&term_id="+a+"&nonce="+l,method:"post",success:function(o){t(".form-loader-count").css("width","0"),"0"==(o=jQuery.parseJSON(o)).status?(t(".folder-popup-form").hide(),t(".folder-popup-form").removeClass("disabled"),t("#error-folder-popup-message").html(o.message),t("#error-folder-popup").show()):(t("#wcp_folder_"+a).hasClass("active")?(t("#wcp_folder_"+a).removeClass("active"),t("#wcp_folder_"+a).find("ul.ui-sortable:first-child > li").slideUp(),e=0):(t("#wcp_folder_"+a).addClass("active"),t("#wcp_folder_"+a).find("ul.ui-sortable:first-child > li").slideDown(),e=1),F())}})}),t(document).on("keyup","#folder-search",function(){N()}),t(document).on("change","#folder-search",function(){N()}),t(document).on("blur","#folder-search",function(){N()}),t(document).on("click","#folder-hide-show-checkbox",function(){t(this).is(":checked")?t("#custom-menu").addClass("show-folder-checkbox"):(t("#custom-menu input.checkbox").attr("checked",!1),t("#custom-menu").removeClass("show-folder-checkbox"))}),t(document).on("click","#inline-remove",function(){t("#custom-menu li.active-item").length?(s=t("#custom-menu li.active-item").data("folder-id"),P(1),t(".dynamic-menu").remove(),t(".active-menu").removeClass("active-menu")):t("#folder-hide-show-checkbox").is(":checked")&&(t(".dynamic-menu").remove(),P(1))})})}(jQuery,_);
|
1 |
+
!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){var o="#js-tree-menu",s=[],a=-1,r=0,l=0,d="",n=-1,c=0,m="",p=folders_media_options.page_url,f="",u="",h=!1,v=!1,g=!1,y=0,x=0,j=wp.media.view.AttachmentFilters.extend({id:"media-attachment-taxonomy-filter",createFilters:function(){var e={};folders_media_options.terms.length;_.each(folders_media_options.terms||{},function(t,o){e[t.term_id]={text:t.name+" ("+t.count+")",props:{media_folder:t.slug}}}),e.all={text:"All Folders",props:{media_folder:""},priority:10},e.unassigned={text:"(Unassigned)",props:{media_folder:"-1"},priority:10},this.filters=e},change:function(){var e={};_.each(folders_media_options.terms||{},function(t,o){e[t.term_id]={text:t.name+" ("+t.count+")",props:{media_folder:t.slug}}}),e.all={text:"Select a folder >>",props:{media_folder:""},priority:10},e.unassigned={text:"(Unassigned)",props:{media_folder:"-1"},priority:10},this.filters=e;var t=this.filters[this.el.value];t&&this.model.set(t.props)}}),w=0,k=0,b=wp.media.view.AttachmentsBrowser;wp.media.view.AttachmentsBrowser=wp.media.view.AttachmentsBrowser.extend({createToolbar:function(){b.prototype.createToolbar.call(this),this.toolbar.set("MediaLibraryOrganizerTaxonomyFilter",new j({controller:this.controller,model:this.collection.props,priority:-75}).render())}});var C,S=wp.media.model.Query;_.extend(S,{get:(C=[],function(e,t){var o,s={},a=S.orderby,r=S.defaultProps;return delete e.query,delete e.cache,_.defaults(e,r),_.each(["include","exclude"],function(t){e[t]&&!_.isArray(e[t])&&(e[t]=[e[t]])}),_.each(e,function(e,t){_.isNull(e)||(s[S.propmap[t]||t]=e)}),_.defaults(s,S.defaultArgs),s.orderby=a.valuemap[e.orderby]||e.orderby,C=[],o||(o=new S([],_.extend(t||{},{props:e,args:s})),C.push(o)),o})});var I=window.wp;void 0!==I&&"function"==typeof I.Uploader&&(I.media.view.Modal.prototype.on("open",function(){setTimeout(function(){e("#media-attachment-taxonomy-filter").length&&("all"==e("#media-attachment-taxonomy-filter").val()&&(e("#media-attachment-taxonomy-filter option:gt(1)").remove(),_.each(folders_media_options.terms,function(t,o){e("#media-attachment-taxonomy-filter").append("<option value='"+t.term_id+"'>"+t.name+" ("+t.count+")</option>")})),e("#wcp-content").length||e(".editor-post-featured-image").length&&e(".attachment-filters").val("all").trigger("change"))},100)}),jQuery.extend(I.Uploader.prototype,{progress:function(){},init:function(){this.uploader&&(this.uploader.bind("FileFiltered",function(t,o){w++,e(".folder-meter").css("width","0%"),e(".media-folder-loader").show(),e("#total_upload_files").text(w)}),this.uploader.bind("BeforeUpload",function(t,o){var s=a,r=t.settings.multipart_params;if((s=parseInt(s))>0&&(r.folder_for_media=s),k<w){e(".media-folder-loader").show();var i=k/w*100;e(".folder-meter").css("width",i+"%")}k++,e("#current_upload_files").text(k)}),this.uploader.bind("UploadComplete",function(e,t){a=-1}),this.uploader.bind("UploadComplete",function(t,o){var s,a=window.wp;e(".folder-meter").css("width","100%"),setTimeout(function(){e(".media-folder-loader").hide(),e(".folder-meter").css("width","0%"),w=0,k=0},1250),s=e("#media-attachment-taxonomy-filter").val(),P=jQuery.ajax({url:folders_media_options.ajax_url,data:"type=attachment&action=wcp_get_default_list&active_id=0",method:"post",beforeSend:function(){null!=P&&P.abort()},success:function(t){var t=jQuery.parseJSON(t);if(e("#media-attachment-taxonomy-filter").length){if(e("#media-attachment-taxonomy-filter").each(function(){folders_media_options.terms=t.taxonomies;var o=e(this);o.html("<option value='all'>All Folders</option><option value='unassigned'>(Unassigned)</option>"),t.taxonomies;for(var a=0;a<t.taxonomies.length;a++)o.append("<option value='"+t.taxonomies[a].term_id+"'>"+t.taxonomies[a].name+" ("+t.taxonomies[a].trash_count+")</option>");o.val(s).trigger("change")}),e("select.folder_for_media").length){var o=e("select.folder_for_media").val();e("select.folder_for_media option:not(:first-child):not(:last-child)").remove();for(var a=0;a<t.taxonomies.length;a++)e("select.folder_for_media option:last-child").before("<option value='"+t.taxonomies[a].term_id+"'>"+t.taxonomies[a].name+"</option>");""!=o&&e(".folder_for_media").val(o)}for(e("span.premio-folder-count").text(""),e(".folder-count").text(""),a=0;a<t.taxonomies.length;a++)0!=parseInt(t.taxonomies[a].trash_count)&&(e(".jstree-node[id='"+t.taxonomies[a].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(t.taxonomies[a].trash_count),e(".sticky-folder-"+t.taxonomies[a].term_id+" .premio-folder-count").text(t.taxonomies[a].trash_count))}}}),void 0!==a.media.frame&&null!==a.media.frame.content.get()?(a.media.frame.content.get().collection.props.set({ignore:+new Date}),a.media.frame.content.get().options.selection.reset()):e("#media-attachment-taxonomy-filter").length&&e(".attachment-filters").each(function(){e(this).trigger("change")})}))}}));var P,D=window.wp;if(void 0!==D&&"function"==typeof D.Uploader){var N=window.wp.media,A=N.view.Modal;N.view.Modal=N.view.Modal.extend({className:"folder-modal",initialize:function(){A.prototype.initialize.apply(this,arguments)},open:function(){e(".folder-modal").removeClass("folder-modal"),A.prototype.open.apply(this,arguments)&&(e(".folder-modal").length?(e(".folder-custom-menu").remove(),e(".folder-modal .media-frame-tab-panel").removeClass("has-folder-menu"),e(".folder-modal .media-frame").hasClass("hide-menu")?e(".folder-custom-menu").length||(e(".folder-modal .media-frame-tab-panel").before("<div class='folder-custom-menu'><div class='folder-menu-content'><div class='cssload-container'><div class='cssload-tube-tunnel'></div></div></div></div>"),e(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url+" #wcp-content-resize",function(){M(),q()})):e(".folder-custom-menu").length||(e(".folder-modal .media-frame-menu").addClass("has-folder-menu"),e(".folder-modal .media-frame-menu .media-menu").append("<div class='folder-custom-menu'><div class='folder-menu-content'><div class='cssload-container'><div class='cssload-tube-tunnel'></div></div></div></div>"),e(".folder-modal .folder-menu-content").load(folders_media_options.media_page_url+" #wcp-content-resize",function(){M()})),e(".folder-form-data").remove(),e(".media-frame-tab-panel:first").before("<div class='folder-form-data'></div>"),e(".folder-form-data").load(folders_media_options.media_page_url+" #folder-add-update-content",function(){})):setTimeout(function(){-1!=a&&e("#media-attachment-taxonomy-filter").each(function(){e(this).val(a),e(this).trigger("change")})},1e3))},close:function(){A.prototype.close.apply(this,arguments),e(".folder-modal").removeClass("folder-modal")}})}function q(){e(o).jstree({core:{cache:!1,animation:0,check_callback:function(t,o,s,a,r){if(e("*").removeClass("drag-bot").removeClass("drag-in").removeClass("drag-up"),("move_node"===t||"copy_node"===t)&&r&&r.dnd)switch(r.pos){case"a":r.origin.get_node(r.ref,!0).addClass("drag-bot"),nodeId=e(".drag-bot").attr("id"),e("#jstree-dnd").text("Below "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;case"i":r.origin.get_node(r.ref,!0).addClass("drag-in"),nodeId=e(".drag-in").attr("id"),e("#jstree-dnd").text("Inside "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;case"b":r.origin.get_node(r.ref,!0).addClass("drag-up"),nodeId=e(".drag-up").attr("id"),e("#jstree-dnd").text("Above "+e.trim(e("#js-tree-menu").jstree(!0).get_node(nodeId).text));break;default:e("#jstree-dnd").text(e("#jstree-dnd").data("txt"))}return!0}},data:{cache:!1},select_node:!1,search:{show_only_matches:!0,case_sensitive:!1,fuzzy:!1},plugins:["dnd","search","contextmenu"],contextmenu:{select_node:0,show_at_node:0,items:function(){return{}}}}).bind("ready.jstree",function(){!function(){e("#js-tree-menu .jstree-node").each(function(){var t=parseInt(e(this).data("count"));t>0&&e(".jstree-node[id='"+e(this).attr("id")+"'] > a span.premio-folder-count").text(t);var o={folder_id:e(this).attr("id"),folder_count:t,is_sticky:e(this).hasClass("is-sticky")?1:0,is_high:e(this).hasClass("is-high")?1:0,nonce:e(this).data("nonce"),slug:e(this).data("slug"),is_deleted:0};s.push(o)}),""!=f&&0!=f&&e(".jstree-node[id='"+f+"']").length&&(e("#js-tree-menu").jstree("select_node",f),e(".sticky-folders .sticky-folder-"+f+" a").length&&e(".sticky-folders .sticky-folder-"+f+" a").addClass("active-item"));e(".ajax-preloader").hide(),e(".js-tree-data").show(),J(),e(".sticky-folders ul > li").length>0&&e(".sticky-folders").addClass("active")}()}).bind("move_node.jstree",function(t,o){folderMoveId=o.node.id,orderString="",e(".jstree-node[id='"+folderMoveId+"']").closest("ul").children().each(function(){"undefined"!=e(this).attr("id")&&(orderString+=e(this).attr("id")+",")}),e("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")?parentID=e("#"+folderMoveId+"_anchor").closest(".jstree-node").parent().parent().attr("id"):parentID=0,""!=orderString&&(e(".form-loader-count").css("width","100%"),jQuery.ajax({url:folders_media_options.ajax_url,data:"term_ids="+orderString+"&action=wcp_save_folder_order&type="+folders_media_options.post_type+"&nonce="+folders_media_options.nonce+"&term_id="+folderMoveId+"&parent_id="+parentID,method:"post",success:function(t){"1"==(t=jQuery.parseJSON(t)).status?(e("#wcp_folder_parent").html(t.options),e(".form-loader-count").css("width","0"),Q(),B()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show(),window.location.reload(!0))}}))})}function O(e,t){if(s.length>0)for(i=0;i<s.length;i++)if(parseInt(s[i].folder_id)==parseInt(e))return s[i][t];return""}function U(e){if(s.length>0)for(i=0;i<s.length;i++)if(parseInt(s[i].folder_id)==parseInt(e))return i;return null}function J(){e(".sticky-folders > ul").html("");var t="";if(e("#js-tree-menu li.jstree-node.is-sticky").each(function(){var o=e(this).attr("id"),s=e.trim(e("#js-tree-menu").jstree(!0).get_node(o).text),a=(e("#"+o+"_anchor .premio-folder-count").text(),e("li.jstree-node[id='"+o+"']").hasClass("is-high")?" is-high ":"");t+="<li data-folder-id='"+o+"' class='sticky-fldr "+a+" sticky-folder-"+o+"'><a href='javascript:;'><span class='folder-title'>"+s+"</span><span class='folder-actions'><span class='update-inline-record'><i class='pfolder-edit-folder'></i></span><span class='star-icon'><i class='pfolder-star'></i></span><span class='premio-folder-count'></span></span></a></li>"}),e(".sticky-folders > ul").html(t),e(".jstree-anchor.jstree-clicked").length){var o=e(".jstree-anchor.jstree-clicked").closest("li.jstree-node").attr("id");e(".sticky-folders .sticky-folder-"+o+" a").addClass("active-item")}e(".sticky-folders > ul > li").length>0?e(".sticky-folders").addClass("active"):e(".sticky-folders").removeClass("active")}function Q(){if(e(".media-toolbar").hasClass("media-toolbar-mode-select")&&e("ul.attachments li.selected").length&&(e("ul.attachments li.selected").trigger("click"),e(".select-mode-toggle-button").trigger("click")),""!=u&&(e("#js-tree-menu a.jstree-clicked").length>0||"-1"==f)){if(e("#media-attachment-taxonomy-filter").length){u=u.split(",");for(var t=0;t<u.length;t++)""!=u[t]&&e(".attachments-browser li[data-id='"+u[t]+"']").remove()}u=""}e("#media-attachment-taxonomy-filter").length?z(0):(e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=get_folders_default_list",method:"post",success:function(o){for(o=e.parseJSON(o),e(".header-posts .total-count").text(o.total_items),e(".un-categorised-items .total-count").text(o.empty_items),t=0;t<o.taxonomies.length;t++)e("#title_"+o.taxonomies[t].term_id+" .total-count").length||e("#title_"+o.taxonomies[t].term_id+" .star-icon").before("<span class='total-count'></span>"),e("#title_"+o.taxonomies[t].term_id+" .total-count").text(parseInt(o.taxonomies[t].trash_count));for(e("span.premio-folder-count").text(""),e(".folder-count").text(""),t=0;t<o.taxonomies.length;t++)0!=parseInt(o.taxonomies[t].trash_count)&&(e(".jstree-node[id='"+o.taxonomies[t].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(o.taxonomies[t].trash_count),e(".sticky-folder-"+o.taxonomies[t].term_id+" .premio-folder-count").text(o.taxonomies[t].trash_count))}}),e(".folder-loader-ajax").addClass("active"),e("#folder-posts-filter").length?e("#folder-posts-filter").load(p+" #posts-filter",function(){var t={Title:"",Url:p};history.pushState(t,t.Title,t.Url),"show"!=folders_media_options.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>'),triggerInlineUpdate()}):e("#wpbody").load(p+" #wpbody-content",!1,function(t){"show"!=folders_media_options.show_in_page||e(".tree-structure").length||e(".wp-header-end").before('<div class="tree-structure-content"><div class="tree-structure"><ul></ul><div class="clear clearfix"></div></div></div>')}))}function F(){var t=e.trim(e("#folder-search").val());e("#js-tree-menu").jstree("search",t)}function H(t){var o="Are you sure you want to delete the selected folder?",s="Items in the folder will not be deleted.";if(h=!1,1==t&&e("#folder-hide-show-checkbox").is(":checked")){if(h=!0,0==e("#js-tree-menu input.checkbox:checked").length)return e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html("Please select at least one folder to delete"),void e("#error-folder-popup").show();e("#js-tree-menu input.checkbox:checked").length>1&&(o="Are you sure you want to delete the selected folders?",s="Items in the selected folders will not be deleted.")}e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#remove-folder-item").text("Yes, Delete it!"),e("#remove-folder-message").text(o),e("#remove-folder-notice").text(s),e("#confirm-remove-folder").show(),e("#remove-folder-item").focus()}function V(){folderName=e.trim(e("#js-tree-menu").jstree(!0).get_node(l).text),parentID=e("#wcp_folder_"+l).closest("li.jstree-node").data("folder-id"),parentID==t&&(parentID=0),e("#update-folder-data").text("Submit"),e(".folder-form-errors").removeClass("active"),e("#update-folder-item-name").val(folderName),e("#update-folder-item").removeClass("disabled"),e("#update-folder-item").show(),e("#update-folder-item-name").focus(),e(".dynamic-menu").remove()}function T(){if(0==c&&n>=10)return e("#folder-limitation-message").html("You've reached the 10 folder limitation!"),e("#no-more-folder-credit").show(),!1;e("#add-update-folder-title").text("Add new folder"),e("#save-folder-data").text("Submit"),e(".folder-form-errors").removeClass("active"),e("#add-update-folder-name").val(""),g&&(y=l,e("#add-update-folder-name").val(e.trim(e("#js-tree-menu").jstree(!0).get_node(l).text)+" #2"),l=e("#"+l+"_anchor").closest(".jstree-node").parent().parent().hasClass("jstree-node")?e("#"+l+"_anchor").closest(".jstree-node").parent().parent().attr("id"):0),e("#add-update-folder").removeClass("disabled"),e("#add-update-folder").show(),e("#add-update-folder-name").focus(),e(".dynamic-menu").remove()}function M(){setTimeout(function(){if(e("#js-tree-menu .jstree-node.jstree-leaf").length==e("#js-tree-menu .jstree-node").length)e("#expand-collapse-list").removeClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Expand");else{var t=e("#js-tree-menu .jstree-node.jstree-closed").length+e("#js-tree-menu .jstree-node.jstree-open").length;e("#js-tree-menu .jstree-node.jstree-closed").length==t?(e("#expand-collapse-list").removeClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Expand")):(e("#expand-collapse-list").addClass("all-open"),e("#expand-collapse-list").attr("data-folder-tooltip","Collapse"))}},500)}function z(o){P=e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_get_default_list&active_id="+f,method:"post",beforeSend:function(){console.log("changed"),null!=P&&P.abort()},success:function(s){if(s=e.parseJSON(s),e(".header-posts .total-count").text(s.total_items),e(".un-categorised-items .total-count").text(s.empty_items),selectedVal=e("#media-attachment-taxonomy-filter").val(),"all"!=selectedVal&&1==o){var a=parent.wp;a.media!=t&&(a.media.frame.setState("insert"),null!==a.media.frame.content.get()?(a.media.frame.content.get().collection.props.set({ignore:+new Date}),a.media.frame.content.get().options.selection.reset()):a.media.frame.library.props.set({ignore:+new Date}))}if(s.taxonomies.length){if(e("#media-attachment-taxonomy-filter").length){folders_media_options.terms=s.taxonomies;var r=e("#media-attachment-taxonomy-filter");for(r.html("<option value='all'>All Folders</option><option value='all'>(Unassigned)</option>"),e(".media-select-folder").html("<option value=''>Select Folder</option><option value='-1'>(Unassigned)</option>"),i=0;i<s.taxonomies.length;i++)r.append("<option value='"+s.taxonomies[i].term_id+"'>"+s.taxonomies[i].name+" ("+s.taxonomies[i].trash_count+")</option>"),e(".media-select-folder").append("<option value='"+s.taxonomies[i].term_id+"'>"+s.taxonomies[i].name+" ("+s.taxonomies[i].trash_count+")</option>");r.val(selectedVal),e(".media-select-folder").val("")}if(e("select.folder_for_media").length){for(selectedVal=e("select.folder_for_media").val(),e("select.folder_for_media option:not(:first-child):not(:last-child)").remove(),i=0;i<s.taxonomies.length;i++)e("select.folder_for_media option:last-child").before("<option value='"+s.taxonomies[i].term_id+"'>"+s.taxonomies[i].name+"</option>");""!=selectedVal&&e(".folder_for_media").val(selectedVal)}for(e("span.premio-folder-count").text(""),i=0;i<s.taxonomies.length;i++)0!=parseInt(s.taxonomies[i].trash_count)&&(e(".jstree-node[id='"+s.taxonomies[i].term_id+"'] > a.jstree-anchor span.premio-folder-count").text(s.taxonomies[i].trash_count),e(".sticky-folder-"+s.taxonomies[i].term_id+" .premio-folder-count").text(s.taxonomies[i].trash_count))}""!=f&&e("#wcp_folder_"+f).addClass("active-item"),v&&(e("#title_"+l).trigger("click"),v=!1)}})}function B(){e(".folder-loader-ajax").addClass("active"),e(".folder-loader-ajax img").removeClass("active"),e(".folder-loader-ajax svg#successAnimation").addClass("active").addClass("animated"),setTimeout(function(){e(".folder-loader-ajax").removeClass("active"),e(".folder-loader-ajax img").addClass("active"),e(".folder-loader-ajax svg#successAnimation").removeClass("active").removeClass("animated")},2e3)}e(document).ready(function(){c=parseInt(folders_media_options.is_key_active),n=parseInt(folders_media_options.folders),e(document).on("click",".header-posts a.all-posts",function(t){l=0,f="",a="all",e(".active-item").removeClass("active-item"),e(".jstree-clicked").removeClass("jstree-clicked"),e(this).addClass("active-item"),e(".sticky-folders .active-item").removeClass("active-item"),e(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("all").trigger("change"),e(this).closest(".media-frame").find(".folder_for_media").val("all").trigger("change")}),e(document).on("click",".un-categorised-items",function(t){l=0,f="",a="unassigned",e(".active-item").removeClass("active-item"),e(".sticky-folders .active-item").removeClass("active-item"),e(".jstree-clicked").removeClass("jstree-clicked"),e(this).addClass("active-item"),e(this).closest(".media-frame").find("#media-attachment-taxonomy-filter").val("unassigned").trigger("change"),e(this).closest(".media-frame").find(".folder_for_media").val("-1").trigger("change")}),e(document).on("click","a.jstree-anchor",function(t){var o,s=e(this).closest("li.jstree-node").attr("id");a=l=s,e(".active-item").removeClass("active-item"),e("#media-attachment-taxonomy-filter").val(s),e("#media-attachment-taxonomy-filter").trigger("change"),thisSlug=O(s,"slug"),o=thisSlug,jQuery.ajax({url:folders_media_options.ajax_url,type:"post",data:"action=save_folder_last_status&post_type="+folders_media_options.post_type+"&post_id="+o+"&nonce="+folders_media_options.nonce,cache:!1,async:!1,success:function(){}}),e(".custom-media-select").removeClass("active")}),e(document).on("change",".folder_for_media",function(){"add-folder"!=e(this).val()&&null!=e(this).val()?a=e(this).val():"add-folder"==e(this).val()&&(a=-1)}),e(document).on("click",".update-inline-record",function(t){t.stopImmediatePropagation(),t.stopPropagation(),0!=folders_media_options.can_manage_folder&&(isHigh=e(this).closest("li.sticky-fldr").hasClass("is-high"),isSticky=e(this).closest("li.sticky-fldr").hasClass("is-sticky"),isStickyClass=!!isSticky,e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(isHigh?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",hasPosts=parseInt(e(this).closest("li.jstree-node").find("h3.title:first > .total-count").text()),"attachment"==folders_media_options.post_type&&hasPosts&&(menuHtml+="<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",e(this).closest("li").append(menuHtml),e(this).offset().top+e(".dynamic-menu").height()>e(window).height()-20&&(e(".dynamic-menu").addClass("bottom-fix"),e(".dynamic-menu.bottom-fix").offset().top<e("#custom-scroll-menu").offset().top&&e(".dynamic-menu").removeClass("bottom-fix")))}),e(document).on("click","body, html",function(t){e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),e(".folder-order").removeClass("active")}),e(document).on("click",".dynamic-menu, .folder-order",function(e){e.stopPropagation()}),e(document).on("contextmenu",".jstree-anchor",function(t){return e(this).find("span.folder-inline-edit").trigger("click"),!1}),e(document).on("click",".folder-actions span.folder-inline-edit",function(t){t.stopImmediatePropagation(),t.stopPropagation(),0!=folders_media_options.can_manage_folder&&(isHigh=e(this).closest("li.jstree-node").hasClass("is-high"),isSticky=e(this).closest("li.jstree-node").hasClass("is-sticky"),isStickyClass=!!isSticky,e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),menuHtml="<div class='dynamic-menu'><ul><li class='new-folder'><a href='javascript:;'><span class=''><i class='pfolder-add-folder'></i></span> New Folder</a></li><li class='rename-folder'><a href='javascript:;'><span class=''><i class='pfolder-edit'></i></span> Rename</a></li><li class='sticky-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class='sticky-pin'><i class='pfolder-pin'></i></span>Sticky Folder (Pro)</a></li><li class='mark-folder'><a href='javascript:;'><span class=''><i class='pfolder-star'></i></span>"+(isHigh?" Remove Star":"Add a Star")+"</a></li><li class='duplicate-folder'><a href='javascript:;'><span class=''><i class='pfolder-clone'></i></span> Duplicate folder</a></li>",hasPosts=parseInt(e(this).closest("a.jstree-anchor").find(".premio-folder-count").text()),"attachment"==folders_media_options.post_type&&hasPosts&&(menuHtml+="<li class='download-folder'><a target='_blank' href='"+folders_media_options.upgrade_url+"'><span class=''><i class='pfolder-zip-file'></i></span> Download Zip (Pro)</a></li>"),menuHtml+="<li class='remove-folder'><a href='javascript:;'><span class=''><i class='pfolder-remove'></i></span> Delete</a></li></ul></div>",e(this).closest("a.jstree-anchor").after(menuHtml),e(this).parents("li.jstree-node").addClass("active-menu"),e(this).offset().top+e(".dynamic-menu").height()>e(window).height()-20&&(e(".dynamic-menu").addClass("bottom-fix"),e(".dynamic-menu.bottom-fix").offset().top<e("#custom-scroll-menu").offset().top&&e(".dynamic-menu").removeClass("bottom-fix")))}),e(document).on("click",".dynamic-menu",function(e){e.stopImmediatePropagation(),e.stopPropagation()}),e(document).on("click","body, html",function(){e(".dynamic-menu").remove()}),e(document).on("click",".new-folder",function(t){t.stopPropagation(),l=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),v=!1,g=!1,T()}),e(document).on("click","#add-new-folder",function(t){l=e("#custom-menu li.active-item").length?e("#custom-menu li.active-item").data("folder-id"):0,v=!1,T()}),e(document).on("submit","#save-folder-form",function(t){if(t.stopPropagation(),t.preventDefault(),d=e("#add-update-folder-name").val(),""==e.trim(d))e(".folder-form-errors").addClass("active"),e("#add-update-folder-name").focus();else{e("#save-folder-data").html('<span class="dashicons dashicons-update"></span>'),e("#add-update-folder").addClass("disabled");var o=l;v&&(o=0),x=0==o?e("#js-tree-menu > ul > li.jstree-node").length:e("#js-tree-menu > ul > li.jstree-node[id='"+o+"'] > ul.jstree-children > li").length+1,e.ajax({url:folders_media_options.ajax_url,data:{parent_id:o,type:folders_media_options.post_type,action:"wcp_add_new_folder",nonce:folders_media_options.nonce,term_id:o,order:x,name:d,is_duplicate:g,duplicate_from:y},method:"post",success:function(t){if(result=e.parseJSON(t),"1"==result.status){c=parseInt(result.is_key_active),n=parseInt(result.folders),e("#current-folder").text(n),e("#ttl-fldr").text(10),M(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled");var o={folder_id:result.term_id,folder_count:0,is_sticky:0,is_high:0,nonce:result.nonce,slug:result.slug,is_deleted:0};s.push(o),B(),J(),e("#js-tree-menu").jstree().create_node(result.parent_id,{id:result.term_id,text:" "+result.title},"last",function(){e(".jstree-node[id='"+result.term_id+"']").attr("data-nonce",result.nonce),e(".jstree-node[id='"+result.term_id+"']").attr("data-slug",result.slug)}),l=result.term_id,z(0)}else e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(result.message),e("#error-folder-popup").show()}})}return!1}),e(document).on("click",".form-cancel-btn",function(){e(".folder-popup-form").hide()}),e(document).on("click",".folder-popup-form",function(t){e(".folder-popup-form").hide()}),e(document).on("click",".popup-form-content",function(e){e.stopPropagation()}),document.onkeydown=function(t){("key"in(t=t||window.event)?"Escape"===t.key||"Esc"===t.key:27===t.keyCode)&&e(".folder-popup-form").hide()},e(".rename-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),l=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),V(),e(".dynamic-menu").remove()})}),e(document).on("click","#inline-update",function(t){e("#js-tree-menu a.jstree-clicked").length&&(l=e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"),V())}),e(document).on("submit","#update-folder-form",function(o){return o.stopPropagation(),o.preventDefault(),d=e("#update-folder-item-name").val(),""==e.trim(d)?(e(".folder-form-errors").addClass("active"),e("#update-folder-item-name").focus()):(e("#update-folder-data").html('<span class="dashicons dashicons-update"></span>'),e("#update-folder-item").addClass("disabled"),m=O(l,"nonce"),parentID=e(".jstree-node[id='"+l+"']").closest("li.jstree-node").attr("id"),parentID==t&&(parentID=0),e.ajax({url:folders_media_options.ajax_url,data:{parent_id:parentID,type:folders_media_options.post_type,action:"wcp_update_folder",nonce:m,term_id:l,order:x,name:d},method:"post",success:function(t){result=e.parseJSON(t),"1"==result.status?(e("#js-tree-menu").jstree("rename_node",result.id," "+result.term_title),folderPostId=U(result.id),null!=folderPostId&&(s[folderPostId].nonce=result.nonce,s[folderPostId].slug=result.slug),e(".folder-popup-form").hide(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),B(),e("#media-attachment-taxonomy-filter").length&&z(0)):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(result.message),e("#error-folder-popup").show())}})),!1}),e(".mark-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),r=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),m=O(r,"nonce"),e(".form-loader-count").css("width","100%"),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu"),e.ajax({url:folders_media_options.ajax_url,data:"term_id="+r+"&type="+folders_media_options.post_type+"&action=wcp_mark_un_mark_folder&nonce="+m,method:"post",cache:!1,success:function(t){t=e.parseJSON(t),e(".form-loader-count").css("width","0%"),"1"==t.status?(folderPostId=U(t.id),"1"==t.marked?(e("li.jstree-node[id='"+t.id+"']").addClass("is-high"),e(".sticky-folder-"+t.id).addClass("is-high"),null!=folderPostId&&(s[folderPostId].is_high=1)):(e("li.jstree-node[id='"+t.id+"']").removeClass("is-high"),e(".sticky-folder-"+t.id).removeClass("is-high"),null!=folderPostId&&(s[folderPostId].is_high=0)),B()):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})})}),e(".duplicate-folder").livequery(function(){e(this).click(function(t){t.stopPropagation(),l=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),e(".dynamic-menu").remove(),v=!1,g=!0,T()})}),e(".remove-folder").livequery(function(){e(this).click(function(){r=e(this).closest("li.jstree-node").data("id"),l=e(this).closest("li.jstree-node").length?e(this).closest("li.jstree-node").attr("id"):e(this).closest("li.sticky-fldr").data("folder-id"),H(0),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu")})}),e(document).on("click","#remove-folder-item",function(t){t.stopPropagation(),e(".folder-popup-form").addClass("disabled"),e("#remove-folder-item").html('<span class="dashicons dashicons-update"></span>'),m=O(l,"nonce"),h?function(){if(e("#folder-hide-show-checkbox").is(":checked")&&e("#custom-menu input.checkbox:checked").length>0){var t="";e("#custom-menu input.checkbox:checked").each(function(){t+=e(this).val()+",",e(this).closest("li.route").hasClass("active-item")&&!0}),e(".form-loader-count").css("width","100%"),e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_remove_muliple_folder&term_id="+t+"&nonce="+folders_media_options.nonce,method:"post",success:function(t){if(t=e.parseJSON(t),e(".form-loader-count").css("width","0px"),"1"==t.status){for(c=parseInt(t.is_key_active),n=parseInt(t.folders),e("#current-folder").text(n),i=0;i<t.term_ids.length;i++)e("#js-tree-menu").jstree().delete_node(t.term_ids[i]);e("#ttl-fldr").text(10),B(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),Q(),J(),B(),e("#wcp_folder_"+f).length||(e(".header-posts a").trigger("click"),f=0)}else window.location.reload();e("#folder-hide-show-checkbox").attr("checked",!1),e("#js-tree-menu input.checkbox").attr("checked",!1),e("#js-tree-menu").removeClass("show-folder-checkbox")}})}}():e.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_remove_folder&term_id="+l+"&nonce="+m,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?(e("#js-tree-menu").jstree().delete_node(l),c=parseInt(t.is_key_active),n=parseInt(t.folders),e("#current-folder").text(n),e("#ttl-fldr").text(10),e(".sticky-folders .sticky-folder-"+l).remove(),B(),e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),Q(),J(),f==l&&e(".header-posts").trigger("click")):(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})}),e(document).on("click","#sort-order-list",function(t){t.stopPropagation(),e(".folder-order").toggleClass("active")}),e(document).on("click","#expand-collapse-list",function(t){t.stopPropagation();var o=0;e(this).hasClass("all-open")?(e(this).removeClass("all-open"),o=0,e(this).attr("data-folder-tooltip","Expand"),e("#js-tree-menu").jstree("close_all")):(e(this).addClass("all-open"),o=1,e(this).attr("data-folder-tooltip","Collapse"),e("#js-tree-menu").jstree("open_all")),u="",e("#js-tree-menu .jstree-node:not(.jstree-leaf)").each(function(){u+=e(this).attr("id")+","}),""!=u&&(e(".form-loader-count").css("width","100%"),m=folders_media_options.nonce,jQuery.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_change_all_status&status="+o+"&folders="+u+"&nonce="+m,method:"post",success:function(t){e(".form-loader-count").css("width","0"),"0"==(t=jQuery.parseJSON(t)).status&&(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show(),window.location.reload(!0))}}))}),e(document).on("click",".folder-sort-menu a",function(t){t.stopPropagation(),t.preventDefault(),e(".form-loader-count").css("width","100%"),e(".folder-order").removeClass("active"),e(this).attr("data-sort"),jQuery.ajax({url:folders_media_options.ajax_url,data:"type="+folders_media_options.post_type+"&action=wcp_folders_by_order&nonce="+folders_media_options.nonce+"&order="+e(this).attr("data-sort"),method:"post",success:function(t){1==(t=jQuery.parseJSON(t)).status&&(e("#js-tree-menu").jstree().destroy(),e("#js-tree-menu").append("<ul></ul>"),e("#js-tree-menu ul").html(t.data),q()),e(".form-loader-count").css("width","0")}})}),e(".jstree-anchor").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){r=e(this).closest("li.jstree-node").attr("id"),o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),m=O(r,"nonce"),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?Q():(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,m=O(r,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(t){"1"==(t=e.parseJSON(t)).status?Q():(e(".folder-popup-form").hide(),e(".folder-popup-form").removeClass("disabled"),e("#error-folder-popup-message").html(t.message),e("#error-folder-popup").show())}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,m=O(r,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),u=chkStr,e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){Q(),B()}}))}})}),e(".media-frame:not(.hide-router) .attachments-browser li.attachment").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:function(t,o){e(".selected-items").remove();var s=e(".media-frame:not(.hide-router) .attachments-browser li.attachment.selected").length;return e("<div class='selected-items'><span class='total-post-count'>"+(s=0==s||1==s?"1 Item":s+" Items")+" Selected</span></div>")},start:function(t,o){e("body").addClass("no-hover-css")},cursor:"move",appendTo:".media-modal",cursorAt:{left:0,top:0},stop:function(t,o){e(".selected-items").remove(),e("body").removeClass("no-hover-css")}})}),e(".un-categorised-items").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){r=-1,m=folders_media_options.nonce,o.draggable.hasClass("wcp-move-multiple")?e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),e.ajax({url:folders_media_options.ajax_url,data:"post_id="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){Q()}})):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,chkStr=postID+",",e(".wp-list-table input:checked").each(function(){postID!=e(this).val()&&(chkStr+=e(this).val()+",")}),e.ajax({url:folders_media_options.ajax_url,data:"post_id="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){Q()}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),u=chkStr,e.ajax({url:folders_media_options.ajax_url,data:"post_id="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_remove_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){Q()}}))}})}),e(".tree-structure .folder-item").livequery(function(){e(this).droppable({accept:".wcp-move-file, .wcp-move-multiple, .attachments-browser li.attachment",hoverClass:"wcp-drop-hover-list",classes:{"ui-droppable-active":"ui-state-highlight"},drop:function(t,o){e("body").removeClass("no-hover-css"),r=e(this).data("id"),o.draggable.hasClass("wcp-move-multiple")?(m=O(r,"nonce"),e(".wp-list-table input:checked").length&&(chkStr="",e(".wp-list-table input:checked").each(function(){chkStr+=e(this).val()+","}),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){Q(),B()}}))):o.draggable.hasClass("wcp-move-file")?(postID=o.draggable[0].attributes["data-id"].nodeValue,m=O(r,"nonce"),chkStr=postID+",",e(".wp-list-table input:checked").each(function(){e(this).val()!=postID&&(chkStr+=e(this).val()+",")}),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){Q(),B()}})):o.draggable.hasClass("attachment")&&(chkStr=o.draggable[0].attributes["data-id"].nodeValue,m=O(r,"nonce"),e(".attachments-browser li.attachment.selected").length>1&&(chkStr="",e(".attachments-browser li.attachment.selected").each(function(){chkStr+=e(this).data("id")+","})),e.ajax({url:folders_media_options.ajax_url,data:"post_ids="+chkStr+"&type="+folders_media_options.post_type+"&action=wcp_change_multiple_post_folder&folder_id="+r+"&nonce="+m+"&status="+folders_media_options.taxonomy_status+"&taxonomy="+f,method:"post",success:function(e){Q(),B()}}))}})}),e(".wcp-move-file").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:"clone",cursor:"move",start:function(t,o){e(this).closest("td").addClass("wcp-draggable"),e("body").addClass("no-hover-css")},stop:function(t,o){e(this).closest("td").removeClass("wcp-draggable"),e("body").removeClass("no-hover-css")}})}),e(".wcp-move-multiple").livequery(function(){e(this).draggable({revert:"invalid",containment:"document",helper:function(t,o){return e(".selected-items").remove(),selectedItems=e("#the-list th input:checked").length,selectedItems>0?(selectedItems=0==selectedItems||1==selectedItems?"1 Item":selectedItems+" Items",e("<div class='selected-items'><span class='total-post-count'>"+selectedItems+" Selected</span></div>")):e("<div class='selected-items'><span class='total-post-count'>Select Items to move</span></div>")},start:function(t,o){e("body").addClass("no-hover-css")},cursor:"move",cursorAt:{left:0,top:0},stop:function(t,o){e(".selected-items").remove(),e("body").removeClass("no-hover-css")}})}),e(".jstree-node .jstree-icon").livequery(function(){e(this).click(function(){r=e(this).closest("li.jstree-node").attr("id"),e("li.jstree-node[id='"+r+"']").hasClass("jstree-open")?folderStatus=0:folderStatus=1,e(".form-loader-count").css("width","100%"),m=O(r,"nonce"),M(),jQuery.ajax({url:folders_media_options.ajax_url,data:"is_active="+folderStatus+"&action=save_wcp_folder_state&term_id="+r+"&nonce="+m,method:"post",success:function(t){e(".form-loader-count").css("width","0"),"0"==(t=jQuery.parseJSON(t)).status||(e("#wcp_folder_"+r).hasClass("active")?(e("#wcp_folder_"+r).removeClass("active"),e("#wcp_folder_"+r).find("ul.ui-sortable:first-child > li").slideUp(),folderStatus=0):(e("#wcp_folder_"+r).addClass("active"),e("#wcp_folder_"+r).find("ul.ui-sortable:first-child > li").slideDown(),folderStatus=1),B())}})})}),e(document).on("keyup","#folder-search",function(){F()}),e(document).on("change","#folder-search",function(){F()}),e(document).on("blur","#folder-search",function(){F()}),e(document).on("click","#folder-hide-show-checkbox",function(){e(this).is(":checked")?e("#js-tree-menu").addClass("show-folder-checkbox"):(e("#js-tree-menu input.checkbox").attr("checked",!1),e("#js-tree-menu").removeClass("show-folder-checkbox"))}),e(document).on("click",".folder-checkbox, .input-checkbox",function(e){e.stopImmediatePropagation(),e.stopPropagation()}),e(document).on("click","#inline-remove",function(){e("#js-tree-menu a.jstree-clicked").length?(l=e("#js-tree-menu a.jstree-clicked").closest("li.jstree-node").attr("id"),H(1),e(".dynamic-menu").remove(),e(".active-menu").removeClass("active-menu")):e("#folder-hide-show-checkbox").is(":checked")&&(e(".dynamic-menu").remove(),H(1))}),e(document).on("change",".folder_for_media",function(){"add-folder"==e(this).val()&&(v=!0,e("#add-new-folder").trigger("click"))})})});
|
folders.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Folders
|
4 |
* Description: Arrange media, pages, custom post types and posts into folders
|
5 |
-
* Version: 2.5.
|
6 |
* Author: Premio
|
7 |
* Author URI: https://premio.io/downloads/folders/
|
8 |
* Text Domain: folders
|
@@ -30,7 +30,7 @@ if(!defined("WCP_FOLDER_URL")) {
|
|
30 |
define('WCP_FOLDER_URL', plugin_dir_url(__FILE__));
|
31 |
}
|
32 |
if(!defined("WCP_FOLDER_VERSION")) {
|
33 |
-
define('WCP_FOLDER_VERSION', "2.5.
|
34 |
}
|
35 |
|
36 |
include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
|
2 |
/**
|
3 |
* Plugin Name: Folders
|
4 |
* Description: Arrange media, pages, custom post types and posts into folders
|
5 |
+
* Version: 2.5.9
|
6 |
* Author: Premio
|
7 |
* Author URI: https://premio.io/downloads/folders/
|
8 |
* Text Domain: folders
|
30 |
define('WCP_FOLDER_URL', plugin_dir_url(__FILE__));
|
31 |
}
|
32 |
if(!defined("WCP_FOLDER_VERSION")) {
|
33 |
+
define('WCP_FOLDER_VERSION', "2.5.9");
|
34 |
}
|
35 |
|
36 |
include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
|
includes/folders.class.php
CHANGED
@@ -308,7 +308,7 @@ class WCP_Folders
|
|
308 |
$trash_count = apply_filters("premio_folder_item_in_taxonomy", $term->term_id, $arg);
|
309 |
}
|
310 |
if($trash_count === null) {
|
311 |
-
$result = $wpdb->get_var("SELECT COUNT(*) FROM {$post_table} p JOIN {$term_table} rl ON p.ID = rl.object_id WHERE rl.term_taxonomy_id = '{$term->
|
312 |
if (intval($result) > 0) {
|
313 |
$trash_count = intval($result);
|
314 |
} else {
|
@@ -949,6 +949,7 @@ class WCP_Folders
|
|
949 |
$admin_url = admin_url("upload.php?post_type=attachment&media_folder=");
|
950 |
|
951 |
wp_enqueue_script('folders-livequery', plugin_dir_url(dirname(__FILE__)) . 'assets/js/livequery.min.js', array(), WCP_FOLDER_VERSION);
|
|
|
952 |
wp_enqueue_script('folders-media', WCP_FOLDER_URL . 'assets/js/page-post-media.min.js', array('media-editor', 'media-views', 'jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION, true);
|
953 |
wp_localize_script('folders-media', 'folders_media_options', array(
|
954 |
'terms' => self::get_terms_hierarchical('media_folder'),
|
@@ -974,33 +975,38 @@ class WCP_Folders
|
|
974 |
'svg_file' => WCP_FOLDER_URL . 'assets/images/pin.png',
|
975 |
));
|
976 |
/* Free/Pro URL Change */
|
|
|
|
|
977 |
wp_enqueue_style('folders-media', WCP_FOLDER_URL . 'assets/css/page-post-media.min.css', array(), WCP_FOLDER_VERSION);
|
978 |
wp_enqueue_style('folder-icon', WCP_FOLDER_URL . 'assets/css/folder-icon.css', array(), WCP_FOLDER_VERSION);
|
979 |
$width = 275;
|
980 |
$width = $width - 40;
|
981 |
$string = "";
|
982 |
$css_text = "";
|
983 |
-
for ($i = 0; $i <= 15; $i++) {
|
984 |
-
$string .= " .space > .route >";
|
985 |
-
$new_width = $width - (13 + (20 * $i));
|
986 |
-
$css_text .= "#custom-menu > {$string} .title { width: {$new_width}px !important; } ";
|
987 |
-
$css_text .= "#custom-menu > {$string} .dynamic-menu { left: " . ($new_width - 190) . "px !important; } ";
|
988 |
-
}
|
989 |
$css_text .= '.ui-state-highlight { background: transparent; border: dashed 1px #0073AA; width:150px; height: 25px !important; }';
|
990 |
$customize_folders = get_option('customize_folders');
|
991 |
if (isset($customize_folders['new_folder_color']) && !empty($customize_folders['new_folder_color'])) {
|
992 |
$css_text .= ".media-frame a.add-new-folder { background-color: " . esc_attr($customize_folders['new_folder_color']) . "; border-color: " . esc_attr($customize_folders['new_folder_color']) . "}";
|
993 |
-
$css_text .= ".wcp-hide-show-buttons .toggle-buttons {background-color: " . esc_attr($customize_folders['new_folder_color']) . "; }";
|
994 |
$css_text .= ".folders-toggle-button span { background-color: " . esc_attr($customize_folders['new_folder_color']) . "; }";
|
995 |
$css_text .= ".ui-resizable-handle.ui-resizable-e:before, .ui-resizable-handle.ui-resizable-w:before {border-color: " . esc_attr($customize_folders['new_folder_color']) . " !important}";
|
996 |
}
|
997 |
if (isset($customize_folders['folder_bg_color']) && !empty($customize_folders['folder_bg_color'])) {
|
998 |
$rgbColor = self::hexToRgb($customize_folders['folder_bg_color']);
|
999 |
-
$css_text .= ".
|
1000 |
-
$css_text .= "body:not(.no-hover-css)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1001 |
$css_text .= ".wcp-drop-hover {background-color: " . esc_attr($customize_folders['folder_bg_color']) . " !important; color: #ffffff; }";
|
1002 |
$css_text .= "#custom-menu .route .nav-icon .wcp-icon {color: " . esc_attr($customize_folders['folder_bg_color']) . " !important;}";
|
1003 |
-
$css_text .= ".
|
|
|
|
|
1004 |
}
|
1005 |
if (isset($customize_folders['bulk_organize_button_color']) && !empty($customize_folders['bulk_organize_button_color'])) {
|
1006 |
$css_text .= "button.button.organize-button { background-color: " . esc_attr($customize_folders['bulk_organize_button_color']) . "; border-color: " . esc_attr($customize_folders['bulk_organize_button_color']) . "; }";
|
@@ -1018,7 +1024,7 @@ class WCP_Folders
|
|
1018 |
}
|
1019 |
}
|
1020 |
if (isset($customize_folders['folder_size']) && !empty($customize_folders['folder_size'])) {
|
1021 |
-
$css_text .= ".wcp-container .route span.title-text, .header-posts a, .un-categorised-items a { font-size: " . esc_attr($customize_folders['folder_size']) . "px; }";
|
1022 |
}
|
1023 |
if (!empty($font_family)) {
|
1024 |
wp_enqueue_style('custom-google-fonts', 'https://fonts.googleapis.com/css?family=' . urlencode($font_family), false);
|
@@ -1675,7 +1681,7 @@ class WCP_Folders
|
|
1675 |
$errorCounter++;
|
1676 |
} else {
|
1677 |
$term_id = self::sanitize_options($postData['term_id']);
|
1678 |
-
if(!wp_verify_nonce($postData['nonce'], '
|
1679 |
$response['message'] = esc_attr__("Your request is not valid", WCP_FOLDER);
|
1680 |
$errorCounter++;
|
1681 |
}
|
@@ -1718,7 +1724,7 @@ class WCP_Folders
|
|
1718 |
$errorCounter++;
|
1719 |
} else {
|
1720 |
$term_id = self::sanitize_options($postData['term_id']);
|
1721 |
-
if(!wp_verify_nonce($postData['nonce'], '
|
1722 |
$response['message'] = esc_attr__("Your request is not valid", WCP_FOLDER);
|
1723 |
$errorCounter++;
|
1724 |
}
|
@@ -1781,6 +1787,14 @@ class WCP_Folders
|
|
1781 |
$order++;
|
1782 |
}
|
1783 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1784 |
$response['status'] = 1;
|
1785 |
$folder_type = self::get_custom_post_type($type);
|
1786 |
/* Free/Pro Class name change */
|
@@ -1948,6 +1962,7 @@ class WCP_Folders
|
|
1948 |
if ($errorCounter == 0) {
|
1949 |
$term_id = self::sanitize_options($postData['term_id']);
|
1950 |
$type = self::sanitize_options($postData['type']);
|
|
|
1951 |
if(!empty($term_id)) {
|
1952 |
$term_id = trim($term_id,",");
|
1953 |
$term_ids = explode(",", $term_id);
|
@@ -1955,6 +1970,7 @@ class WCP_Folders
|
|
1955 |
foreach ($term_ids as $term) {
|
1956 |
self::remove_folder_child_items($term, $type);
|
1957 |
}
|
|
|
1958 |
}
|
1959 |
}
|
1960 |
$is_active = 1;
|
@@ -1997,7 +2013,7 @@ class WCP_Folders
|
|
1997 |
$errorCounter++;
|
1998 |
} else {
|
1999 |
$term_id = self::sanitize_options($postData['term_id']);
|
2000 |
-
if(!wp_verify_nonce($postData['nonce'], '
|
2001 |
$error = esc_attr__("Unable to delete folder, Your request is not valid", WCP_FOLDER);
|
2002 |
$errorCounter++;
|
2003 |
}
|
@@ -2014,6 +2030,7 @@ class WCP_Folders
|
|
2014 |
$folders = self::ttl_fldrs();
|
2015 |
}
|
2016 |
$response['folders'] = $folders;
|
|
|
2017 |
$response['is_key_active'] = $is_active;
|
2018 |
} else {
|
2019 |
$response['error'] = 1;
|
@@ -2067,7 +2084,7 @@ class WCP_Folders
|
|
2067 |
$errorCounter++;
|
2068 |
} else {
|
2069 |
$term_id = self::sanitize_options($postData['term_id']);
|
2070 |
-
if(!wp_verify_nonce($postData['nonce'], '
|
2071 |
$error = esc_attr__("Unable to rename folder, Your request is not valid", WCP_FOLDER);
|
2072 |
$errorCounter++;
|
2073 |
}
|
@@ -2085,9 +2102,12 @@ class WCP_Folders
|
|
2085 |
)
|
2086 |
);
|
2087 |
if (!empty($result)) {
|
|
|
2088 |
$response['id'] = $result['term_id'];
|
|
|
2089 |
$response['status'] = 1;
|
2090 |
$response['term_title'] = $postData['name'];
|
|
|
2091 |
} else {
|
2092 |
$response['message'] = esc_attr__("Unable to rename folder", WCP_FOLDER);
|
2093 |
}
|
@@ -2159,7 +2179,7 @@ class WCP_Folders
|
|
2159 |
if (!(0 !== $term && null !== $term)) {
|
2160 |
$slug = self::create_slug_from_string($postData['name']) . "-" . time();
|
2161 |
$result = wp_insert_term(
|
2162 |
-
$postData['name'], // the term
|
2163 |
$folder_type, // the taxonomy
|
2164 |
array(
|
2165 |
'parent' => $parent,
|
@@ -2177,7 +2197,6 @@ class WCP_Folders
|
|
2177 |
update_term_meta($parent, "is_active", 1);
|
2178 |
}
|
2179 |
|
2180 |
-
$count = "";
|
2181 |
$class = "";
|
2182 |
|
2183 |
if(isset($postData['is_duplicate']) && $postData['is_duplicate'] == true) {
|
@@ -2224,29 +2243,14 @@ class WCP_Folders
|
|
2224 |
}
|
2225 |
}
|
2226 |
}
|
2227 |
-
$delete_nonce = wp_create_nonce('wcp_folder_delete_term_'.$term->term_id);
|
2228 |
-
$rename_nonce = wp_create_nonce('wcp_folder_rename_term_'.$term->term_id);
|
2229 |
-
$highlight_nonce = wp_create_nonce('wcp_folder_highlight_term_'.$term->term_id);
|
2230 |
$term_nonce = wp_create_nonce('wcp_folder_term_'.$term->term_id);
|
2231 |
/* Free/Pro URL Change */
|
2232 |
-
/* Free/Pro URL Change*/
|
2233 |
-
$string = "<li data-nonce='{$term_nonce}' data-star='{$highlight_nonce}' data-rename='{$rename_nonce}' data-delete='{$delete_nonce}' data-slug='{$term->slug}' class='ui-state-default route wcp_folder_{$term->term_id} {$class}' id='wcp_folder_{$term->term_id}' data-folder-id='{$term->term_id}'>";
|
2234 |
-
$string .= "<h3 class='title' title='{$term->name}' id='title_{$term->term_id}'>";
|
2235 |
-
$string .= "<span class='ui-icon'>";
|
2236 |
-
$string .= "<i class='wcp-icon pfolder-folder-close'></i>";
|
2237 |
-
$string .= "<input type='checkbox' class='checkbox' value='{$term->term_id}' />";
|
2238 |
-
$string .= "</span>";
|
2239 |
-
$string .= "<span class='title-text'>{$term->name}</span>";
|
2240 |
-
$string .= "{$count} <span class='update-inline-record'><i class='pfolder-edit-folder'></i></span> <span class='star-icon'><i class='pfolder-star'></i></span>";
|
2241 |
-
$string .= "<span class='folder-sticky-icon'><i class='pfolder-pin'></i></span>";
|
2242 |
-
// $string .= "<span class='move-folder-icon' ><i class='pfolder-move'></i></span>";
|
2243 |
-
$string .= "</h3>";
|
2244 |
-
$string .= "<span class='nav-icon'><i class='wcp-icon pfolder-arrow-down'></i></span>";
|
2245 |
-
$string .= "<ul class='space' id='space_{$term->term_id}'>";
|
2246 |
-
$string .= "</ul></li>";
|
2247 |
-
$response['term_data'] = $string;
|
2248 |
$response['parent_id'] = $parent;
|
|
|
|
|
2249 |
$response['term_id'] = $result['term_id'];
|
|
|
|
|
2250 |
|
2251 |
$is_active = 1;
|
2252 |
$folders = -1;
|
@@ -2634,10 +2638,10 @@ class WCP_Folders
|
|
2634 |
function folders_admin_styles()
|
2635 |
{
|
2636 |
if (self::is_active_for_screen()) {
|
2637 |
-
|
2638 |
-
wp_enqueue_style('wcp-folders-
|
2639 |
-
|
2640 |
-
wp_enqueue_style('wcp-folders-
|
2641 |
}
|
2642 |
wp_register_style('wcp-css-handle', false);
|
2643 |
wp_enqueue_style('wcp-css-handle');
|
@@ -2751,8 +2755,10 @@ class WCP_Folders
|
|
2751 |
if (self::is_active_for_screen()) {
|
2752 |
global $typenow;
|
2753 |
/* Free/Pro Version change */
|
2754 |
-
|
2755 |
-
wp_register_script('wcp-folders-custom', plugin_dir_url(dirname(__FILE__)) . 'assets/js/custom.js', array('jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION);
|
|
|
|
|
2756 |
|
2757 |
|
2758 |
$post_type = self::get_custom_post_type($typenow);
|
@@ -2829,9 +2835,6 @@ class WCP_Folders
|
|
2829 |
'show_in_page' => $show_in_page,
|
2830 |
'svg_file' => WCP_FOLDER_URL.'assets/images/pin.png',
|
2831 |
));
|
2832 |
-
wp_enqueue_script('wcp-folders-alert');
|
2833 |
-
wp_enqueue_script('wcp-folders-custom');
|
2834 |
-
|
2835 |
} else {
|
2836 |
self::is_add_update_screen();
|
2837 |
}
|
@@ -3019,6 +3022,29 @@ class WCP_Folders
|
|
3019 |
|
3020 |
add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $position);
|
3021 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3022 |
/* Do not Change Free/Pro Change for menu */
|
3023 |
add_submenu_page(
|
3024 |
$menu_slug,
|
@@ -3037,6 +3063,10 @@ class WCP_Folders
|
|
3037 |
}
|
3038 |
}
|
3039 |
|
|
308 |
$trash_count = apply_filters("premio_folder_item_in_taxonomy", $term->term_id, $arg);
|
309 |
}
|
310 |
if($trash_count === null) {
|
311 |
+
$result = $wpdb->get_var("SELECT COUNT(*) FROM {$post_table} p JOIN {$term_table} rl ON p.ID = rl.object_id WHERE rl.term_taxonomy_id = '{$term->term_taxonomy_id}' AND p.post_status != 'trash' LIMIT 1");
|
312 |
if (intval($result) > 0) {
|
313 |
$trash_count = intval($result);
|
314 |
} else {
|
949 |
$admin_url = admin_url("upload.php?post_type=attachment&media_folder=");
|
950 |
|
951 |
wp_enqueue_script('folders-livequery', plugin_dir_url(dirname(__FILE__)) . 'assets/js/livequery.min.js', array(), WCP_FOLDER_VERSION);
|
952 |
+
wp_enqueue_script('folders-tree', WCP_FOLDER_URL . 'assets/js/jstree.min.js', array(), WCP_FOLDER_VERSION, true);
|
953 |
wp_enqueue_script('folders-media', WCP_FOLDER_URL . 'assets/js/page-post-media.min.js', array('media-editor', 'media-views', 'jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION, true);
|
954 |
wp_localize_script('folders-media', 'folders_media_options', array(
|
955 |
'terms' => self::get_terms_hierarchical('media_folder'),
|
975 |
'svg_file' => WCP_FOLDER_URL . 'assets/images/pin.png',
|
976 |
));
|
977 |
/* Free/Pro URL Change */
|
978 |
+
wp_enqueue_style('folders-jstree', WCP_FOLDER_URL . 'assets/css/jstree.min.css', array(), WCP_FOLDER_VERSION);
|
979 |
+
wp_enqueue_style('folder-folders', WCP_FOLDER_URL . 'assets/css/folders.min.css', array(), WCP_FOLDER_VERSION);
|
980 |
wp_enqueue_style('folders-media', WCP_FOLDER_URL . 'assets/css/page-post-media.min.css', array(), WCP_FOLDER_VERSION);
|
981 |
wp_enqueue_style('folder-icon', WCP_FOLDER_URL . 'assets/css/folder-icon.css', array(), WCP_FOLDER_VERSION);
|
982 |
$width = 275;
|
983 |
$width = $width - 40;
|
984 |
$string = "";
|
985 |
$css_text = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
986 |
$css_text .= '.ui-state-highlight { background: transparent; border: dashed 1px #0073AA; width:150px; height: 25px !important; }';
|
987 |
$customize_folders = get_option('customize_folders');
|
988 |
if (isset($customize_folders['new_folder_color']) && !empty($customize_folders['new_folder_color'])) {
|
989 |
$css_text .= ".media-frame a.add-new-folder { background-color: " . esc_attr($customize_folders['new_folder_color']) . "; border-color: " . esc_attr($customize_folders['new_folder_color']) . "}";
|
990 |
+
$css_text .= ".wcp-hide-show-buttons .toggle-buttons { background-color: " . esc_attr($customize_folders['new_folder_color']) . "; }";
|
991 |
$css_text .= ".folders-toggle-button span { background-color: " . esc_attr($customize_folders['new_folder_color']) . "; }";
|
992 |
$css_text .= ".ui-resizable-handle.ui-resizable-e:before, .ui-resizable-handle.ui-resizable-w:before {border-color: " . esc_attr($customize_folders['new_folder_color']) . " !important}";
|
993 |
}
|
994 |
if (isset($customize_folders['folder_bg_color']) && !empty($customize_folders['folder_bg_color'])) {
|
995 |
$rgbColor = self::hexToRgb($customize_folders['folder_bg_color']);
|
996 |
+
$css_text .= "body:not(.no-hover-css) #custom-scroll-menu .jstree-hovered:not(.jstree-clicked), body:not(.no-hover-css) #custom-scroll-menu .jstree-hovered:not(.jstree-clicked):hover { background: rgba(".$rgbColor['r'].",".$rgbColor['g'].",".$rgbColor['b'].", 0.08) !important; color: #333333;}";
|
997 |
+
$css_text .= "body:not(.no-hover-css) #custom-scroll-menu .jstree-clicked, body:not(.no-hover-css) #custom-scroll-menu .jstree-clicked:not(.jstree-clicked):focus, #custom-scroll-menu .jstree-clicked, #custom-scroll-menu .jstree-clicked:hover { background: ".$customize_folders['folder_bg_color']." !important; color: #ffffff !important; }";
|
998 |
+
$css_text .= "#custom-scroll-menu .jstree-hovered.wcp-drop-hover, #custom-scroll-menu .jstree-hovered.wcp-drop-hover:hover, #custom-scroll-menu .jstree-clicked.wcp-drop-hover, #custom-scroll-menu .jstree-clicked.wcp-drop-hover:hover, body #custom-scroll-menu *.drag-in >, body #custom-scroll-menu *.drag-in > a:hover { background: ".$customize_folders['folder_bg_color']." !important; color: #ffffff !important; }";
|
999 |
+
$css_text .= ".drag-bot > a { border-bottom: solid 2px ".$customize_folders['folder_bg_color']."}";
|
1000 |
+
$css_text .= ".drag-up > a { border-top: solid 2px ".$customize_folders['folder_bg_color']."}";
|
1001 |
+
$css_text .= "body:not(.no-hover-css) #custom-scroll-menu *.drag-in > a.jstree-hovered, body:not(.no-hover-css) #custom-scroll-menu *.drag-in > a.jstree-hovered:hover {background: ".$customize_folders['folder_bg_color']." !important; color: #fff !important;}";
|
1002 |
+
$css_text .= ".orange-bg > span, .jstree-clicked, .header-posts a.active-item, .un-categorised-items.active-item, .sticky-folders ul li a.active-item { background-color: " . esc_attr($customize_folders['folder_bg_color']) . " !important; color: #ffffff !important; }";
|
1003 |
+
$css_text .= "body:not(.no-hover-css) .wcp-container .route .title:hover, body:not(.no-hover-css) .header-posts a:hover, body:not(.no-hover-css) .un-categorised-items:hover, body:not(.no-hover-css) .sticky-folders ul li a:hover { background: rgba(".esc_attr($rgbColor['r'].",".$rgbColor['g'].",".$rgbColor['b'].", 0.08")."); color: #333333;}";
|
1004 |
+
//$css_text .= "body:not(.no-hover-css) .wcp-container .route .title:hover, .header-posts a:hover, .un-categorised-items.active-item, .un-categorised-items:hover, .sticky-folders ul li a:hover {background: rgba(" . esc_attr($rgbColor['r'] . "," . $rgbColor['g'] . "," . $rgbColor['b'] . ", 0.08") . "); color:#444444;}";
|
1005 |
$css_text .= ".wcp-drop-hover {background-color: " . esc_attr($customize_folders['folder_bg_color']) . " !important; color: #ffffff; }";
|
1006 |
$css_text .= "#custom-menu .route .nav-icon .wcp-icon {color: " . esc_attr($customize_folders['folder_bg_color']) . " !important;}";
|
1007 |
+
$css_text .= ".mCS-3d.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {background-color: " . esc_attr($customize_folders['folder_bg_color']) . " !important;}";
|
1008 |
+
$css_text .= "body:not(.no-hover-css) .jstree-hovered {background: rgba(" . esc_attr($rgbColor['r'] . "," . $rgbColor['g'] . "," . $rgbColor['b'] . ", 0.08") . "}";
|
1009 |
+
$css_text .= ".jstree-default .jstree-clicked {" . esc_attr($customize_folders['folder_bg_color']) . "}";
|
1010 |
}
|
1011 |
if (isset($customize_folders['bulk_organize_button_color']) && !empty($customize_folders['bulk_organize_button_color'])) {
|
1012 |
$css_text .= "button.button.organize-button { background-color: " . esc_attr($customize_folders['bulk_organize_button_color']) . "; border-color: " . esc_attr($customize_folders['bulk_organize_button_color']) . "; }";
|
1024 |
}
|
1025 |
}
|
1026 |
if (isset($customize_folders['folder_size']) && !empty($customize_folders['folder_size'])) {
|
1027 |
+
$css_text .= ".wcp-container .route span.title-text, .header-posts a, .un-categorised-items a, .sticky-title { font-size: " . esc_attr($customize_folders['folder_size']) . "px; }";
|
1028 |
}
|
1029 |
if (!empty($font_family)) {
|
1030 |
wp_enqueue_style('custom-google-fonts', 'https://fonts.googleapis.com/css?family=' . urlencode($font_family), false);
|
1681 |
$errorCounter++;
|
1682 |
} else {
|
1683 |
$term_id = self::sanitize_options($postData['term_id']);
|
1684 |
+
if(!wp_verify_nonce($postData['nonce'], 'wcp_folder_term_'.$term_id)) {
|
1685 |
$response['message'] = esc_attr__("Your request is not valid", WCP_FOLDER);
|
1686 |
$errorCounter++;
|
1687 |
}
|
1724 |
$errorCounter++;
|
1725 |
} else {
|
1726 |
$term_id = self::sanitize_options($postData['term_id']);
|
1727 |
+
if(!wp_verify_nonce($postData['nonce'], 'wcp_folder_term_'.$term_id)) {
|
1728 |
$response['message'] = esc_attr__("Your request is not valid", WCP_FOLDER);
|
1729 |
$errorCounter++;
|
1730 |
}
|
1787 |
$order++;
|
1788 |
}
|
1789 |
}
|
1790 |
+
$term_id = self::sanitize_options($postData['term_id']);
|
1791 |
+
$parent_id = self::sanitize_options($postData['parent_id']);
|
1792 |
+
$type = self::sanitize_options($postData['type']);
|
1793 |
+
$folder_type = self::get_custom_post_type($type);
|
1794 |
+
wp_update_term($term_id, $folder_type, array(
|
1795 |
+
'parent' => $parent_id
|
1796 |
+
));
|
1797 |
+
|
1798 |
$response['status'] = 1;
|
1799 |
$folder_type = self::get_custom_post_type($type);
|
1800 |
/* Free/Pro Class name change */
|
1962 |
if ($errorCounter == 0) {
|
1963 |
$term_id = self::sanitize_options($postData['term_id']);
|
1964 |
$type = self::sanitize_options($postData['type']);
|
1965 |
+
$response['term_ids'] = array();
|
1966 |
if(!empty($term_id)) {
|
1967 |
$term_id = trim($term_id,",");
|
1968 |
$term_ids = explode(",", $term_id);
|
1970 |
foreach ($term_ids as $term) {
|
1971 |
self::remove_folder_child_items($term, $type);
|
1972 |
}
|
1973 |
+
$response['term_ids'] = $term_ids;
|
1974 |
}
|
1975 |
}
|
1976 |
$is_active = 1;
|
2013 |
$errorCounter++;
|
2014 |
} else {
|
2015 |
$term_id = self::sanitize_options($postData['term_id']);
|
2016 |
+
if(!wp_verify_nonce($postData['nonce'], 'wcp_folder_term_'.$term_id)) {
|
2017 |
$error = esc_attr__("Unable to delete folder, Your request is not valid", WCP_FOLDER);
|
2018 |
$errorCounter++;
|
2019 |
}
|
2030 |
$folders = self::ttl_fldrs();
|
2031 |
}
|
2032 |
$response['folders'] = $folders;
|
2033 |
+
$response['term_id'] = $term_id;
|
2034 |
$response['is_key_active'] = $is_active;
|
2035 |
} else {
|
2036 |
$response['error'] = 1;
|
2084 |
$errorCounter++;
|
2085 |
} else {
|
2086 |
$term_id = self::sanitize_options($postData['term_id']);
|
2087 |
+
if(!wp_verify_nonce($postData['nonce'], 'wcp_folder_term_'.$term_id)) {
|
2088 |
$error = esc_attr__("Unable to rename folder, Your request is not valid", WCP_FOLDER);
|
2089 |
$errorCounter++;
|
2090 |
}
|
2102 |
)
|
2103 |
);
|
2104 |
if (!empty($result)) {
|
2105 |
+
$term_nonce = wp_create_nonce('wcp_folder_term_'.$result['term_id']);
|
2106 |
$response['id'] = $result['term_id'];
|
2107 |
+
$response['slug'] = $result['slug'];
|
2108 |
$response['status'] = 1;
|
2109 |
$response['term_title'] = $postData['name'];
|
2110 |
+
$response['nonce'] = $term_nonce;
|
2111 |
} else {
|
2112 |
$response['message'] = esc_attr__("Unable to rename folder", WCP_FOLDER);
|
2113 |
}
|
2179 |
if (!(0 !== $term && null !== $term)) {
|
2180 |
$slug = self::create_slug_from_string($postData['name']) . "-" . time();
|
2181 |
$result = wp_insert_term(
|
2182 |
+
urldecode($postData['name']), // the term
|
2183 |
$folder_type, // the taxonomy
|
2184 |
array(
|
2185 |
'parent' => $parent,
|
2197 |
update_term_meta($parent, "is_active", 1);
|
2198 |
}
|
2199 |
|
|
|
2200 |
$class = "";
|
2201 |
|
2202 |
if(isset($postData['is_duplicate']) && $postData['is_duplicate'] == true) {
|
2243 |
}
|
2244 |
}
|
2245 |
}
|
|
|
|
|
|
|
2246 |
$term_nonce = wp_create_nonce('wcp_folder_term_'.$term->term_id);
|
2247 |
/* Free/Pro URL Change */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2248 |
$response['parent_id'] = $parent;
|
2249 |
+
$response['slug'] = $term->slug;
|
2250 |
+
$response['nonce'] = $term_nonce;
|
2251 |
$response['term_id'] = $result['term_id'];
|
2252 |
+
$response['title'] = urldecode($postData['name']);
|
2253 |
+
$response['parent_id'] = empty($postData['parent_id'])?"#":$postData['parent_id'];
|
2254 |
|
2255 |
$is_active = 1;
|
2256 |
$folders = -1;
|
2638 |
function folders_admin_styles()
|
2639 |
{
|
2640 |
if (self::is_active_for_screen()) {
|
2641 |
+
wp_enqueue_style('wcp-folders-fa', plugin_dir_url(dirname(__FILE__)) . 'assets/css/folder-icon.css', array(), WCP_FOLDER_VERSION);
|
2642 |
+
wp_enqueue_style('wcp-folders-admin', plugin_dir_url(dirname(__FILE__)) . 'assets/css/design.min.css', array(), WCP_FOLDER_VERSION);
|
2643 |
+
wp_enqueue_style('wcp-folders-jstree', plugin_dir_url(dirname(__FILE__)) . 'assets/css/jstree.min.css', array(), WCP_FOLDER_VERSION);
|
2644 |
+
wp_enqueue_style('wcp-folders-css', plugin_dir_url(dirname(__FILE__)) . 'assets/css/folders.min.css', array(), WCP_FOLDER_VERSION);
|
2645 |
}
|
2646 |
wp_register_style('wcp-css-handle', false);
|
2647 |
wp_enqueue_style('wcp-css-handle');
|
2755 |
if (self::is_active_for_screen()) {
|
2756 |
global $typenow;
|
2757 |
/* Free/Pro Version change */
|
2758 |
+
wp_enqueue_script('wcp-folders-alert', plugin_dir_url(dirname(__FILE__)) . 'assets/js/livequery.min.js', array(), WCP_FOLDER_VERSION);
|
2759 |
+
// wp_register_script('wcp-folders-custom', plugin_dir_url(dirname(__FILE__)) . 'assets/js/custom.js', array('jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION);
|
2760 |
+
wp_enqueue_script('wcp-folders-jstree', plugin_dir_url(dirname(__FILE__)) . 'assets/js/jstree.min.js', array('jquery'), WCP_FOLDER_VERSION);
|
2761 |
+
wp_enqueue_script('wcp-folders-custom', plugin_dir_url(dirname(__FILE__)) . 'assets/js/folders.min.js', array('jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'backbone'), WCP_FOLDER_VERSION);
|
2762 |
|
2763 |
|
2764 |
$post_type = self::get_custom_post_type($typenow);
|
2835 |
'show_in_page' => $show_in_page,
|
2836 |
'svg_file' => WCP_FOLDER_URL.'assets/images/pin.png',
|
2837 |
));
|
|
|
|
|
|
|
2838 |
} else {
|
2839 |
self::is_add_update_screen();
|
2840 |
}
|
3022 |
|
3023 |
add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $position);
|
3024 |
|
3025 |
+
|
3026 |
+
$getData = filter_input_array(INPUT_GET);
|
3027 |
+
if(isset($getData['hide_folder_recommended_plugin']) && isset($getData['nonce'])) {
|
3028 |
+
if(current_user_can('manage_options')) {
|
3029 |
+
$nonce = $getData['nonce'];
|
3030 |
+
if(wp_verify_nonce($nonce, "folder_recommended_plugin")) {
|
3031 |
+
update_option('hide_folder_recommended_plugin',"1");
|
3032 |
+
}
|
3033 |
+
}
|
3034 |
+
}
|
3035 |
+
|
3036 |
+
$recommended_plugin = get_option("hide_folder_recommended_plugin");
|
3037 |
+
if($recommended_plugin === false) {
|
3038 |
+
add_submenu_page(
|
3039 |
+
$menu_slug,
|
3040 |
+
esc_html__('Recommended Plugins', WCP_FOLDER),
|
3041 |
+
esc_html__('Recommended Plugins', WCP_FOLDER),
|
3042 |
+
'manage_options',
|
3043 |
+
'recommended-folder-plugins',
|
3044 |
+
array($this, 'recommended_plugins')
|
3045 |
+
);
|
3046 |
+
}
|
3047 |
+
|
3048 |
/* Do not Change Free/Pro Change for menu */
|
3049 |
add_submenu_page(
|
3050 |
$menu_slug,
|
3063 |
}
|
3064 |
}
|
3065 |
|
3066 |
+
public function recommende
|