()
| 1386 | |
| 1387 | // 附加操作 |
| 1388 | let _addEvents = function () { |
| 1389 | |
| 1390 | // 折叠、展开 |
| 1391 | $('#jfContent span.expand').bind('click', function (ev) { |
| 1392 | ev.preventDefault(); |
| 1393 | ev.stopPropagation(); |
| 1394 | |
| 1395 | let parentEl = $(this).parent(); |
| 1396 | parentEl.toggleClass('collapsed'); |
| 1397 | |
| 1398 | if (parentEl.hasClass('collapsed')) { |
| 1399 | collapse(parentEl); |
| 1400 | } |
| 1401 | }); |
| 1402 | |
| 1403 | // 点击选中:高亮 |
| 1404 | $('#jfContent .item').bind('click', function (e) { |
| 1405 | |
| 1406 | let el = $(this); |
| 1407 | |
| 1408 | if (el.hasClass('x-selected')) { |
| 1409 | _toogleStatusBar(el, false); |
| 1410 | _addOptForItem(el, false); |
| 1411 | el.removeClass('x-selected'); |
| 1412 | _emitSelectionChange($()); |
| 1413 | e.stopPropagation(); |
| 1414 | return true; |
| 1415 | } |
| 1416 | |
| 1417 | _selectJsonElement(el, {scroll: false}); |
| 1418 | |
| 1419 | if (!$(e.target).is('.item .expand')) { |
| 1420 | e.stopPropagation(); |
| 1421 | } else { |
| 1422 | $(e.target).parent().trigger('click'); |
| 1423 | } |
| 1424 | |
| 1425 | // 触发钩子 |
| 1426 | if (typeof window._OnJsonItemClickByFH === 'function') { |
| 1427 | window._OnJsonItemClickByFH(getJsonText(el)); |
| 1428 | } |
| 1429 | }); |
| 1430 | |
| 1431 | // 行悬停效果:只高亮当前直接悬停的item,避免嵌套冒泡 |
| 1432 | let currentHoverElement = null; |
| 1433 | |
| 1434 | $('#jfContent .item').bind('mouseenter', function (e) { |
| 1435 | // 只处理视觉效果,不触发任何其他逻辑 |
| 1436 | |
| 1437 | // 清除之前的悬停样式 |
| 1438 | if (currentHoverElement) { |
| 1439 | currentHoverElement.removeClass('fh-hover'); |
| 1440 | } |
| 1441 | |
| 1442 | // 添加当前悬停样式 |
| 1443 | let el = $(this); |
| 1444 | el.addClass('fh-hover'); |
| 1445 | currentHoverElement = el; |
no test coverage detected