简体   繁体   English

代码块在 mozilla firefox 中工作,但在 Chrome 中不工作

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

Does anyone have any idea why this code block might work well in Mozilla Perfectly and not at all in Chrome?有谁知道为什么这个代码块在 Mozilla Perfectly 中运行良好,而在 Chrome 中则完全不运行? This code block is generating and presenting perfectly in Mozilla Firefox, but not at all in the Chrome search engine.此代码块在 Mozilla Firefox 中完美生成和呈现,但在 Chrome 搜索引擎中完全没有。 This started when I placed some new code into the block starting at the x = -1 variable and below.这开始于我将一些新代码放入从 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.

相关问题 Java代码可在Mozilla Firefox中运行,但不能在Google Chrome中运行 - Javascript code working in Mozilla Firefox but not in Google Chrome Window.close(); 在Chrome和Mozilla Firefox中无法使用 - The Window.close(); is not working in Chrome and Mozilla Firefox 网站滑块在Google Chrome和Mozilla firefox上不起作用 - website slider is not working on Google Chrome and Mozilla firefox 我的javascript代码无法在mozilla firefox中运行 - My javascript code not working in mozilla firefox table.rows.length在mozilla firefox中不起作用,但在Google Chrome中起作用 - table.rows.length not working in mozilla firefox but working in google chrome 代码在Google Chrome中不起作用,但在Mozilla中可以正常工作 - Code not working in google chrome but works fine with Mozilla 为什么Cut,Copy,Paste在Mozilla Firefox和Google Chrome浏览器中不起作用? - why Cut,Copy,Paste is not working in Mozilla Firefox and Google Chrome browser? 为什么我的扩展程序在 Mozilla Firefox 上运行而不是在 Google Chrome 上运行? - Why is my extension working on Mozilla Firefox and not on Google Chrome? Javascript(JS)应用程序可在Chrome上运行,但不能在mozilla firefox / safari上运行 - Javascript (JS) application working on Chrome but not on mozilla firefox/safari Mozilla Firefox innerhtml无法正常工作 - Mozilla Firefox innerhtml not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM