MCPcopy Index your code
hub / github.com/zxlie/FeHelper / _getHtmlFragment

Function _getHtmlFragment

apps/json-format/content-script.js:697–780  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

695 };
696
697 let _getHtmlFragment = () => {
698
699 // 判断当前地区是否在美国
700 const isInUSA = () => {
701 // 通过时区判断是否在美国
702 const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
703 const isUSTimeZone = /^America\/(New_York|Chicago|Denver|Los_Angeles|Anchorage|Honolulu)/.test(timeZone);
704
705 // 通过语言判断
706 const language = navigator.language || navigator.userLanguage;
707 const isUSLanguage = language.toLowerCase().indexOf('en-us') > -1;
708
709 // 如果时区和语言都符合美国特征,则认为在美国
710 return (isUSTimeZone && isUSLanguage);
711 };
712
713 return [
714 '<div id="jfToolbar" class="x-toolbar fh-json-viewbar" style="display:none">' +
715 ' <div class="fh-viewbar-brand">' +
716 ' <a href="https://fehelper.com" target="_blank" class="x-a-title fh-viewbar-logo">' +
717 ' <img src="' + chrome.runtime.getURL('static/img/fe-16.png') + '" alt="FeHelper"/><span>FeHelper</span></a>' +
718 ' <span class="fh-viewbar-title-divider" aria-hidden="true">|</span>' +
719 ' <span class="x-b-title fh-viewbar-title">JSON 格式化</span>' +
720 ' </div>' +
721 ' <div class="fh-viewbar-main">' +
722 ' <span class="x-sort fh-viewbar-group fh-sort-group">' +
723 ' <span class="x-split">|</span>' +
724 ' <span class="fh-sort-menu">' +
725 ' <button type="button" class="fh-sort-trigger" aria-haspopup="true" aria-label="JSON 键名排序">' +
726 ' <span>排序</span><strong id="fhJsonSortCurrent">默认</strong><i aria-hidden="true"></i>' +
727 ' </button>' +
728 ' <span class="fh-sort-options" role="radiogroup" aria-label="JSON 键名排序选项">' +
729 ' <label class="fh-radio-pill fh-sort-option" for="sort_null"><input type="radio" name="jsonsort" id="sort_null" value="0" checked><span>默认</span></label>' +
730 ' <label class="fh-radio-pill fh-sort-option" for="sort_asc"><input type="radio" name="jsonsort" id="sort_asc" value="1"><span>升序</span></label>' +
731 ' <label class="fh-radio-pill fh-sort-option" for="sort_desc"><input type="radio" name="jsonsort" id="sort_desc" value="-1"><span>降序</span></label>' +
732 ' </span>' +
733 ' </span>' +
734 ' </span>' +
735 ' <span class="x-fix-encoding fh-viewbar-group"><span class="x-split">|</span><button class="xjf-btn" id="jsonGetCorrectCnt">乱码修正</button></span>' +
736 ' <span id="optionBar" class="fh-viewbar-group fh-option-bar"></span>' +
737 ' <span class="fh-viewbar-group fh-omni-tools" aria-label="JSON Omni 高级操作">' +
738 ' <span class="x-split">|</span>' +
739 ' <span class="fh-search-menu">' +
740 ' <button type="button" class="fh-search-trigger" id="fhJsonSearchTrigger" aria-haspopup="true" aria-label="搜索 JSON 内容">' +
741 ' <span>搜索</span><strong id="fhJsonSearchCount" class="fh-json-search-count is-empty">0/0</strong><i aria-hidden="true"></i>' +
742 ' </button>' +
743 ' <span class="fh-search-popover" role="group" aria-label="搜索与节点操作">' +
744 ' <span class="fh-json-search-box">' +
745 ' <input id="fhJsonSearchInput" type="search" placeholder="搜索 Key / 值" autocomplete="off" spellcheck="false" title="搜索 JSON 内容,按 Enter 跳转">' +
746 ' <button type="button" class="xjf-btn" id="fhJsonSearchPrev" title="上一条">上</button>' +
747 ' <button type="button" class="xjf-btn" id="fhJsonSearchNext" title="下一条">下</button>' +
748 ' </span>' +
749 ' <span class="fh-node-actions">' +
750 ' <button type="button" class="xjf-btn" id="fhJsonCopyPath">复制路径</button>' +
751 ' <button type="button" class="xjf-btn" id="fhJsonCopyValue">复制节点</button>' +
752 ' </span>' +
753 ' </span>' +
754 ' </span>' +

Callers 1

_mountFormatterShellFunction · 0.85

Calls 1

isInUSAFunction · 0.85

Tested by

no test coverage detected