• Resolved damelco

    (@damelco)


    it took me several days to get here … bear with me.

    having used formidable/formidable-pro and had a couple of orphaned right brackets (‘]’) in our form, probably resulting from poorly written shortcodes in some (I think formidable’s) plugin.

    the site was ready to go live and I needed them gone.
    so I decided to use js to scan the page and remove them after ready and load were complete.

    seemed to work great!

    then ran across a strange problem which I at first had no clue as to the source.
    certain forms were blank … and no, I don’t mean the form lacked data, the page was actually blank … the elements were all in place, but invisible.

    finally figured out HOW that was happening … an inline style was being added to the formidable <form> element (.e.g. style=”opacity:0;”). at the time I discovered HOW the page was blank, I hadn’t a clue why it was being inserted OR what triggered insertion.

    a process of trial and err, I found disabling easy fancybox stopped the anomaly. but I also knew this issue was new, and I had not touched easy fancybox nor formidable for quite some time. so what was new that might trigger this?

    I found disabling my “bracket cleaner” routine stopped the apparent insertion of inline opacity style by easy fancybox but why in the first place?

    the only guess I have is easy fancybox is either being caught while processing the page by my script and it is changing something why being processed for another purpose (which is not likely in an synchronous environment), or easy fancybox is actually monitoring the page for changes and is interpreting my edit as a queue for it to do something, by design?!

    thoughts?

    peace

    -DJ

    • This topic was modified 4 years, 11 months ago by damelco.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi DJ, that’s an interesting case ??

    What I can tell you about the Easy FancyBox plugin: it scans the page on page load (jQuery document.ready event) for media links. And it also scans the page when an event called “post-load” happens. This event is triggered by plugins like Jetpack’s Infinite Scroll module. After loading new posts, this event gets tiggered, causing Easy FancyBox to rescan for new media links.

    So unless your custom script is triggering a “post-load” event, Easy FancyBox should not be re-scanning your page content.

    May I ask why you are using a script to clean stray closing brackets from post content? Are these closing brackets present in your database or when editing the posts? If so, there are plugins or direct MYSQL manipulations that can get rid for these definitively.

    Or are they “left” over, after shortcode processing by a (formidable) plugin? If so, it’d be best to report this as bug or (at least) support request there, because that really should not happen.

    You might also try to auto-close any shortcodes you are using. So instead of [form id="123"] do [form id="123" /] (unless the short code is already closed, see next example!) or close them like: [form id="123"]Loading...[/form] (the text “Loading…” is not needed, it’s just an example of shortcode usage).

    Unclosed shortcodes can cause issues when there are multiple shortcodes on one page, and one of them is closed and the others are not.

    Thread Starter damelco

    (@damelco)

    hey Ravan,

    thanks for the quick response!
    no, it is a very simple standalone script;

            var removeOrphanSCBracket = document.getElementsByClassName("frm_no_entries");
    
        for (var i = (removeOrphanSCBracket.length - 1); i >= 0; i--)
        {
            var rNode = removeOrphanSCBracket[i];
            var lastEl = rNode.innerHTML.lastIndexOf(">");
            var isOrphan = rNode.innerHTML.lastIndexOf("]");
            if (isOrphan>=0 && lastEl>=0 && isOrphan>lastEl) {
                var tmp = rNode.innerHTML;
                rNode.innerHTML = tmp.substring(0, isOrphan)+tmp.substring(isOrphan+1);
            }
        }
    

    as for the cause … yes formidable is the cause, but they generally do not fix issues like this. I have about 35 overrides for formidable defects they ‘choose’ to ignore.

    the shortcode problem is not a closure issue, but an issue that ‘tends’ to create the orphans when nesting shortcodes;

    [frm-field-value field_id=trust-name user_id=[get param="puid" default="current"]]
    

    sometimes rearranging attributes helps, but often they are strictly ordered. and mostly there no additional attributes to “buffer” the order anyway!

    I have written many of my own shortcodes to eliminate these problems. but its like fighting a forest-fire with a squirt gun.

    let me try triggering my script after a timer loop … maybe it will change (eliminate) the collateral effect?!?!

    -DJ

    Thread Starter damelco

    (@damelco)

    hey Ravan,

    actually, after thinking about what you said I thought changing that rather large chunk of code by updating the innerHTML is probably at fault, even though I only deleting one character.

    so I rewrote the filter to search for the textNode containing the orphaned “]” … and just deleted that textNode.

    problem solved!

    thanks again for the plugin and your assistance.

    peace

    -DJ

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘butting heads’ is closed to new replies.