|
@@ -83,29 +83,33 @@ class SiteAlbumController extends AdminController
|
|
|
|
|
|
Admin::script(
|
|
|
<<<JS
|
|
|
- setTimeout(() => {
|
|
|
-
|
|
|
- const anchors = document.querySelectorAll('a.jstree-anchor');
|
|
|
- anchors.forEach(anchor => {
|
|
|
-
|
|
|
- const id = anchor.id.split('_')[0];
|
|
|
-
|
|
|
- const href = `/prime-control/site-album?folder_id=`+id;
|
|
|
-
|
|
|
- anchor.addEventListener('click', function(event) {
|
|
|
- event.preventDefault();
|
|
|
- window.location.href = href;
|
|
|
- });
|
|
|
-
|
|
|
- folderId = $('select[name="folder_id"]').data('value');
|
|
|
- if (folderId == id) {
|
|
|
-
|
|
|
- anchor.classList.add('jstree-clicked');
|
|
|
- }
|
|
|
+
|
|
|
+const interval = setInterval(() => {
|
|
|
+ const containerUl = document.querySelector('.jstree-container-ul');
|
|
|
+ if (containerUl) {
|
|
|
+ clearInterval(interval);
|
|
|
+
|
|
|
+ const folderId = $('select[name="folder_id"]').data('value');
|
|
|
+ const anchors = document.querySelectorAll('a.jstree-anchor');
|
|
|
+
|
|
|
+ anchors.forEach(anchor => {
|
|
|
+ const id = anchor.id.split('_')[0];
|
|
|
+ const href = `/prime-control/site-album?folder_id=`+id;
|
|
|
+
|
|
|
+
|
|
|
+ anchor.addEventListener('click', event => {
|
|
|
+ event.preventDefault();
|
|
|
+ window.location.href = href;
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+ if (folderId == id) {
|
|
|
+ anchor.classList.add('jstree-clicked');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+}, 100);
|
|
|
|
|
|
- }, 100);
|
|
|
const firstCheckbox = document.querySelector('.vs-checkbox-primary');
|
|
|
|
|
|
if (firstCheckbox) {
|
|
@@ -117,8 +121,6 @@ class SiteAlbumController extends AdminController
|
|
|
|
|
|
input.value = '';
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
JS
|
|
|
);
|
|
|
});
|