簡體   English   中英

代碼塊在 mozilla firefox 中工作,但在 Chrome 中不工作

[英]Code block working in mozilla firefox but not in Chrome

有誰知道為什么這個代碼塊在 Mozilla Perfectly 中運行良好,而在 Chrome 中則完全不運行? 此代碼塊在 Mozilla Firefox 中完美生成和呈現,但在 Chrome 搜索引擎中完全沒有。 這開始於我將一些新代碼放入從 x = -1 變量及以下開始的塊中。

function displaySideBarLink( title, sectionname, anchorid) {

    let sidebar;

    if ($) {
        sidebar = $('#page-layout #record-sidebar .w3-container.menu-links');
    }

    if (sidebar) {
        // Create a link in the side bar navigation
        let sidebar_link = document.createElement("a");


        let section_title = title || sectionname;
        if (section_title) {
            sidebar_link.id = sectionname + "-sidebar";
            sidebar_link.className = "w3-bar-item";
            sidebar_link.href = '#' + anchorid;

            sidebar_link.title = section_title;
            sidebar_link.alt = section_title;
            sidebar_link.innerText = section_title;


            sidebar.append(sidebar_link);
        }

    }

    x = -1
    lastName = ""
    $("#panels-region .panel-heading").each(function () {
        x++
        console.log($(this))
        curName = $(this).attr("name")
        $('<a id="panels-sidebar-' + curName.replace(/ |\//g, "_") + '" class="w3-bar-item" href="#panel-' + x + '-header" title="' + curName.replace(/ |\//g, "_") + '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + curName + '</a>').insertAfter("#panels-sidebar" + lastName.replace(/ |\//g, "_"))
        console.log($(this).attr("name"), lastName)
        lastName = "-" + curName
    })
    lastName = ""
    $("#graph-region .panel-heading h4").each(function () {
        try {
            x++
            console.log($(this).text())
            curName = $(this).text().replace("Collapse panelExpand panel", "")
            $('<a id="tree_viewers-sidebar-' + curName.replace(/ |\//g, "_") + '" class="w3-bar-item" href="#panel-' + x + '-header" title="' + curName.replace(/ |\//g, "_") + '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + curName + '</a>').insertAfter("#tree_viewers-sidebar" + lastName.replace(/ |\//g, "_"))
            console.log($(this).attr("name"), lastName)
            lastName = "-" + curName
        } catch (e) {
        }
    })

    $(".menu-links a").css("padding", "0px 8px")

    $(".field-value").each(function () {
        $(this).html($(this).text())
    })
    $("#tables-content td").each(function () {
        $(this).html($(this).text())
    })
    $(".panel-body").css("background-color", "white")
    $("#panels-region .panel-wrapper .panel-default").css("background-color", "white")
}
function getRecordUI( alias, type, id, viewtype, version ) {

    // Get record model from Data Model Registry
    if ( type ) {
        getJSONUIModel( type,
            function ( data ) {
                displayRecordSections( alias, type, id, version, viewtype, data );
            },
            function (error) {
                console.log("Error getting UI model for type " + type);
                console.log(error);
                displayRecordSections( alias, type, id, version, viewtype, null );
            });
    } else {
        displayRecordSections( alias, type, id, version, viewtype, null );
    }
    let x = -1;
    lastName = "";
    $("#panels-region .panel-heading").each(function () {
        x++

        console.log($(this))
        let curName = $(this).attr("name")
        $('<a id="panels-sidebar-' + curName.replace(/ |\//g, "_") + '" class="w3-bar-item" href="#panel-' + x + '-header" title="' + curName.replace(/ |\//g, "_") + '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + curName + '</a>').insertAfter("#panels-sidebar" + lastName.replace(/ |\//g, "_"))
        console.log($(this).attr("name"), lastName)
        lastName = "-" + curName
    })

    $("#graph-region .panel-heading h4").each(function () {
        x++
        let x = -1;
        console.log($(this).text())
        let curName = $(this).text().replace("Collapse panelExpand panel", "")
        $('<a id="tree_viewers-sidebar-' + curName.replace(/ |\//g, "_") + '" class="w3-bar-item" href="#panel-' + x + '-header" title="' + curName.replace(/ |\//g, "_") + '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + curName + '</a>').insertAfter("#tree_viewers-sidebar" + lastName.replace(/ |\//g, "_"))
        console.log($(this).attr("name"), lastName)
        lastName = "-" + curName
    })

    $(".menu-links a").css("padding", "0px 8px")
    $(".panel-body").css("background-color", "white")
    $("#panels-region .panel-wrapper .panel-default").css("background-color", "white")

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM