• Login
  • Register
  • Login Register
    Login
    Username:
    Password:
  • Home
  • Members
  • Team
  • Help
  • More
    • YouTube
    • Facebook
User Links
  • Login
  • Register
  • Login Register
    Login
    Username:
    Password:

    Quick Links Home Members Team Help
    More Subscribe YouTube Facebook
    D&D Forums - MyBB Plugins & Themes MyBB Ressources Premium MyBB Themes Support EMERALD (extended): JS Uncaught TypeError & Expand/Collaped boxes

     
    • 0 Vote(s) - 0 Average
    EMERALD (extended): JS Uncaught TypeError & Expand/Collaped boxes
    Vitor Costa (APDCA IT)
    Offline

    Junior Member

    Posts: 6
    Threads: 4
    Joined: Nov 2022
    Reputation: 0
    #1
    11-28-2022, 02:32 PM (This post was last modified: 11-28-2022, 04:04 PM by Vitor Costa (APDCA IT). Edit Reason: replying myself, possible fix, issue resolved )
    Hi guys :-)

    I found that on EXTENDED VERSION OF EMERALD every time I click to expand or collapse the tabs on the user CP it generates a JS error. I tested also here to validade if it was me only or so, but seems that the same error occurs here in this forum ...

    Don't know also if that could be related with the fact that when we revisit the user CP the browser don't "remember" the last expanded/collapsed state. Maybe not supposed to... don't know.
    [Image: attachment.php?aid=102]
    Code:
    general.js?ver=1804:690 Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
        at Object.expandCollapse (general.js?ver=1804:690:89)
        at HTMLElement.<anonymous> (general.js?ver=1804:666:18)
        at HTMLElement.dispatch (jquery.js?ver=1804:2:43090)
        at v.handle (jquery.js?ver=1804:2:41074)



    EDIT: 
    A bit replying to myself Smile ...

    I tracked the funcion a bit in the general.js file.
     
    I think It can be something to do with the fact that the theme is not using images to represent the maximized and minimized, and its using font awesome icons to make those representation so the tag "img" a his "src" are null.

    Also then, as it fails, it doesn't run the saveCollapsed function etc etc... 
    [Image: attachment.php?aid=103]
    Code:
            if(expandedItem.length)
            {
                var expState = + !expandedItem.is(":hidden"),
                    expcolImg = element.attr("src"),            
                    expText = [lang.expcol_collapse, lang.expcol_expand];

                expandedItem.toggle("fast", this.expCallback(controls, expState));
                
                element.attr({
                    "alt": expText[expState],
                    "title": expText[expState],
                    "src": expState ? expcolImg.replace('collapse.', 'collapse_collapsed.') : expcolImg.replace('collapse_collapsed.', 'collapse.')
                })
                .parents(':eq(1)').toggleClass(element.parents(':eq(1)').hasClass('thead') ? 'thead_collapsed' : 'tcat_collapse_collapsed');
                this.saveCollapsed(controls, expState);
            }
            return true;


    EDIT again... last time. 
    By now I edited the file general.js, and in the "expandCollapse: function(element)" I made a check typeof to test if it is undefined  before procede.
    All work now without erros and the state of the boxes keeps "remembered"  Big Grin  as it is saved in the cookie.

    [Image: attachment.php?aid=104]


    Attached Files Thumbnail(s)
               
    AmazOuz
    Offline

    Administrator

    Posts: 272
    Threads: 34
    Joined: Oct 2017
    Reputation: 11
    #2
    11-30-2022, 10:39 AM
    Thanks for your investigation and solution for this ^^
    These are of course harmless JS errors but it's always better to clean them
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)



    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    D&D Company

    Home · Members · Team · Help · Contact

    © D&D - Powered by MyBB

    Paris, France

    07 53 04 58 86

    business@developement.design

    About the company We are a growing company of web developers & designers, specialized in MyBB plugins & themes. Our work is our propaganda.

    Linear Mode
    Threaded Mode