()
| 770 | |
| 771 | // 从 localStorage 获取弹窗位置 |
| 772 | function getDialogPosition() { |
| 773 | try { |
| 774 | const saved = localStorage.getItem('ns-filter-dialog-position'); |
| 775 | if (!saved) return null; |
| 776 | |
| 777 | const position = JSON.parse(saved); |
| 778 | |
| 779 | // 验证位置数据有效性(宽松验证,恢复时会自动调整边界) |
| 780 | if (position && |
| 781 | typeof position.left === 'number' && typeof position.top === 'number' && |
| 782 | !isNaN(position.left) && !isNaN(position.top) && |
| 783 | position.left >= -1000 && position.top >= -1000) { // 只检查明显异常的值 |
| 784 | return position; |
| 785 | } else { |
| 786 | // 清除无效数据 |
| 787 | localStorage.removeItem('ns-filter-dialog-position'); |
| 788 | |
| 789 | return null; |
| 790 | } |
| 791 | } catch (error) { |
| 792 | // 解析错误时清除数据 |
| 793 | localStorage.removeItem('ns-filter-dialog-position'); |
| 794 | return null; |
| 795 | } |
| 796 | } |
| 797 | |
| 798 | // 检查是否为移动设备 |
| 799 | function isMobileDevice() { |
nothing calls this directly
no outgoing calls
no test coverage detected