Skip to content

Recent Cards plugin customization

Solved Customisation
  • @phenomlab lol yes, that is exactly what I was looking for 😄
    it worked great!

    thank you very much 😄

    Screen Shot 2022-04-05 at 11.40.43 AM.png

  • phenomlabundefined phenomlab has marked this topic as solved on
  • @crazycells Happy to help. That function wasn’t always there - I just finished writing it 🙂

  • @phenomlab said in Recent Cards plugin customization:

    @crazycells Happy to help. That function wasn’t always there - I just finished writing it 🙂

    Thanks a lot 🙂 🙏

  • @crazycells No problems. Feel free to comment out line

    console.log("data-cid " + dataId + " is " + color);
    

    From that function as it’s only used to ensure the script is picking up the relevant background-color from the category.

  • @phenomlab I think in dark mode, it is going back to normal. Is there an easy way to keep the same border color in dark mode as well?

  • @crazycells Dark mode shouldn’t have any impact - can you provide a URL where I can see this ?

  • @phenomlab Yes, I see the issue. It’s because of lazy CSS classes meaning this below will override everything else when body.lights-out is appended to the existing CSS class.

    body.lights-out .recent-cards .recent-card-container .recent-card {
        background-color: #2E2E2E;
        border: #848484;
    }
    

    You should be able to work around that by adding this into your custom CSS

    body.lights-out .recent-cards .recent-card-container .recent-card {
        border: 1px solid #848484;
    }
    

    b1dbdcde-f723-4446-b3c8-3f4f4d6856fb-image.png

    Let me know how you get on.

  • @phenomlab Yes, I found the lines and fixed them 😄

    Thank you very much. Since the recent card plugin-related codes are not included in the night mode plugin; we have previously added some custom codes for recent cards… Apparently, those codes were creating the problem. Now, it is fixed 👍

  • phenomlabundefined phenomlab referenced this topic on
  • phenomlabundefined phenomlab referenced this topic on
  • hi @phenomlab , somehow recent cards are not clickable in my forum after using these codes, however, it works fine here…

    Normally, when I click a card it takes me to that topic, however, nothing happens now.

    I use this CSS:

    
    li.col-md-3.col-sm-6.col-xs-12.recent-card-container {
        width: 290px !important;
    }
    

    this JS code:

    $(document).ready(function() {
        $(window).on('action:ajaxify.end', function(data) {
            $('.recent-card-container').each(function(i) {
                var dataId = $(this).attr("data-cid");
                var color = $('[role="presentation"]', this).css("background-color");
                console.log("data-cid " + dataId + " is " + color);
                $('[data-cid="' + dataId + '"] .recent-card').attr("style", "border-color: " + color);
            });
        });
    });
    
    $(document).ready(function() {
        $(window).on('action:ajaxify.end', function(data) {
       var categoryColor = $('[role="presentation"].icon').css("background-color");
                    $('li.topic-owner-post:nth-child(1)').css('border-color', categoryColor);
        });
    });
    
    
    window.addEventListener("load", () => {
        // CHROME
        if (navigator.userAgent.indexOf("Chrome") != -1) {
            console.log("Google Chrome");
            $(window).on('action:ajaxify.end', function(data) {
                $('.carousel-mode').bxSlider({
                    auto: false,
                    autoControls: true,
                    stopAutoOnClick: true,
                    pager: false,
                    keyboardEnabled: true,
                    touchEnabled: false
                });
            });
        } else {
            console.log("Others");
            $(window).on('action:ajaxify.end', function(data) {
                $('.carousel-mode').bxSlider({
                    auto: false,
                    autoControls: true,
                    stopAutoOnClick: true,
                    pager: false,
                    keyboardEnabled: true,
                    touchEnabled: true
                });
            });
        }
    });
    

    and this header:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    <script src="https://cdn.jsdelivr.net/bxslider/4.2.12/jquery.bxslider.min.js"></script>
    
  • @crazycells Strange. Are there any errors appearing in the console at your end ? When I look at the console itself, I see

    0a1b4841-6da4-4809-958e-4636441ada61-image.png

    However, this doesn’t seem to have any impact on the recent cards - the links appear to work fine. I think this may be a caching issue at your end ?

  • @phenomlab hmm, I tried on different browsers with iPhone.

    First of all, when I delete this code:

    
    window.addEventListener("load", () => {
        // CHROME
        if (navigator.userAgent.indexOf("Chrome") != -1) {
            console.log("Google Chrome");
            $(window).on('action:ajaxify.end', function(data) {
                $('.carousel-mode').bxSlider({
                    auto: false,
                    autoControls: true,
                    stopAutoOnClick: true,
                    pager: false,
                    keyboardEnabled: true,
                    touchEnabled: false
                });
            });
        } else {
            console.log("Others");
            $(window).on('action:ajaxify.end', function(data) {
                $('.carousel-mode').bxSlider({
                    auto: false,
                    autoControls: true,
                    stopAutoOnClick: true,
                    pager: false,
                    keyboardEnabled: true,
                    touchEnabled: true
                });
            });
        }
    });
    

    then, everything is normal, cards are clickable but of course, sliding does not work.

    However, when I activate it, I could not click the cards on Safari, but it was working on Firefox. I can slide the cards on both browsers by the way.

    So, I guess like Google Chrome, Safari has its own problems with this sliding application?

  • I forgot to write… I do not see any errors on the console.

  • @crazycells odd. Should actually work on Safari. Can you change the line under “Others” to be touchEnabled: false and see if that allows you to select the href links ?

    Obviously, save the code and reload the site before testing again.

  • @phenomlab said in Recent Cards plugin customization:

    @crazycells odd. Should actually work on Safari. Can you change the line under “Others” to be touchEnabled: false and see if that allows you to select the href links ?

    Obviously, save the code and reload the site before testing again.

    with this change, in both Safari and Firefox browsers, I can click the cards and go to the topics, however sliding does not work.

  • @crazycells yes, unsurprising as they both use the webkit CSS rendering engine. This will be the same bug I reference earlier that affects Google Chrome. Not much that can be done sadly.

  • @pobojmoks that’s easily done by modifying the code provided here so that it targets background rather than border

    In essence, the below should work

    $(document).ready(function() {
        $(window).on('action:ajaxify.end', function(data) {
            $('.recent-card-container').each(function(i) {
                var dataId = $(this).attr("data-cid");
                var color = $('[role="presentation"]', this).css("background-color");
                console.log("data-cid " + dataId + " is " + color);
                $('[data-cid="' + dataId + '"] .recent-card').attr("style", "background-color: " + color);
            });
        });
    });
    
  • phenomlabundefined phenomlab referenced this topic on

Did this solution help you?
Did you find the suggested solution useful? Why not buy me a coffee? It's a nice gesture, and a great way to show your appreciation 💗

  • Nodebb design

    Solved General
    2
    1 Votes
    2 Posts
    145 Views

    @Panda said in Nodebb design:

    One negative is not being so good for SEO as more Server side rendered forums, if web crawlers dont run the JS to read the forum.

    From recollection, Google and Bing have the capability to read and process JS, although it’s not in the same manner as a physical person will consume content on a page. It will be seen as plain text, but will be indexed. However, it’s important to note that Yandex and Baidu will not render JS, although seeing as Google has a 90% share of the content available on the web in terms of indexing, this isn’t something you’ll likely lose sleep over.

    @Panda said in Nodebb design:

    The “write api” is preferred for server-to-server interactions.

    This is mostly based around overall security - you won’t typically want a client machine changing database elements or altering data. This is why you have “client-side” which could be DOM manipulation etc, and “server-side” which performs more complex operations as it can communicate directly with the database whereas the client cannot (and if it can, then you have a serious security flaw). Reading from the API is perfectly acceptable on the client-side, but not being able to write.

    A paradigm here would be something like SNMP. This protocol exists as a UDP (UDP is very efficient, as it is “fire and forget” and does not wait for a response like TCP does) based service which reads performance data from a remote source, thus enabling an application to parse that data for use in a monitoring application. In all cases, SNMP access should be “RO” (Read Only) and not RW (Read Write). It is completely feasible to assume complete control over a firewall for example by having RW access to SNMP and then exposing it to the entire internet with a weak passphrase.

    You wouldn’t do it (at least, I hope you wouldn’t) and the same ethic applies to server-side rendering and the execution of commands.

  • restarting nodebb on boot

    Unsolved Configure
    3
    1 Votes
    3 Posts
    218 Views

    @eeeee said in restarting nodebb on boot:

    can I just run nodebb under nodemon for auto restarts?

    It’s a better method. Nodemon just looks for file system changes and would effectively die if the server was rebooted meaning you’d have to start it again anyway. Systemd is the defacto standard which is how the operating system interacts in terms of services, scheduled tasks etc.

  • 1 Votes
    2 Posts
    259 Views

    @Sala This should look better

    .sidenav .navbar-brand { padding-top: 0.5rem; padding-bottom: 0.5rem; }

    e5cec20e-be36-4ee8-9129-fd11ad4656ac-image.png

    You can increase the top and bottom padding by increasing the values above.

  • 3 Votes
    11 Posts
    705 Views

    @cagatay no problems

  • Fontawesome 5

    Unsolved Customisation
    14
    1 Votes
    14 Posts
    678 Views

    @pwsincd hi. Just following up on this thread (I know it’s old) but was curious to understand if it’s still an issue or not ?

  • 10 Votes
    16 Posts
    807 Views

    @crazycells said in creating topic specific widgets:

    Additionally if hide class exists, why are we re-defining it?

    We’re not 🤭 I misspelled it - it should be hidden

  • 0 Votes
    7 Posts
    805 Views

    @RiekMedia hi. Just following up on this thread (I know it’s old) but was curious to understand if it’s still an issue or not ?

  • Iframely (Nodebb)

    Solved Configure
    40
    4 Votes
    40 Posts
    2k Views

    @DownPW This is now resolved. The issue was an incorrect URL specified in the Nodebb plugin. I’ve corrected this, and now it works as intended.