Announcement

Collapse
No announcement yet.

Custom BB Code breaks in 5.6.1?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom BB Code breaks in 5.6.1?

    Good morning. Since updating to 5.6.1, my custom BB code that embeds tweets in a post no longer works. Someone at vbulletin.org suggested it that the allowed length of the replacement code may have changed in this version? Has that changed?? The replacement code is below:

    Code:
     <div data-tweet-param="TweetUrlOrTweetIdHere"></div><script>(function(){function k(a,c){var d=Element.prototype;return(d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.msM atchesSelector||function(a){return-1!==[].indexOf.call(document.querySelectorAll(a),this)}).call(a,c)}function g(a,c){return a?k(a,c)?a:"HTML"===a.tagName?null:g(a.parentNode,c):null}var b="TweetUrlOrTweetIdHere",a,e=document.getElementsByTagName("script"),e=e[e.length-1],f;if(/^http[s]*:\/\//.test(b)){a=document.createElement("a");a.href=b;b=a.pathname.substring(a.pathname.lastInd exOf("/")+1)}f=e.parentNode.querySelector('[data-tweet-param="TweetUrlOrTweetIdHere"]:empty');(a=g(f,".js-post"))?a=a.getAttribute("data-node-id"):(a=g(f,".js-post-sm"),a=a?a.getAttribute("data-nodeid"):Math.floor(Math.random()*10000));a="t_"+(a||"")+"_"+b;window[a]=function(a){f.innerHTML=a.html;a=f.getElementsByTagName("script");for(var c,d=document.getElementsByTagName("head")[0],b=0;b<a.length;b++)a[b].src?(c=document.createElement("script"),c.src=a[b].src,d.appendChild(c)):eval(a[b].textContent)};var h=document.createElement("script");h.src="https://api.twitter.com/1/statuses/oembed.json?id="+b+decodeURIComponent("%26")+"callback="+a;e.parentNode.appendChild(h)})() ;</script>

  • #2
    Here's what we have for a custom Twitter embed code, maybe it'll help you.

    Code:
    <blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr"><a href="https://twitter.com/twt/status/{param}">Embedded Tweet</a></blockquote>
    <script src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
    You put the Tweet ID in between the tags.

    Example: [tw]387657648666980352[/tw]

    Use {option}: Yes
    Remove tag if empty: No
    Disable BB code within this BB code: Yes
    Disable smilies: Yes
    Disable Word wrapping: Yes
    Disable Automatic link parsing: Yes

    Comment


    • #3
      The limit on the length of the replacement is actually 16MB. In some older versions there was a bug that would limit this to 200 characters. I don't believe that bug exists anymore and no changes to how Custom BBCode works is documented that I can see.

      What breaks in it?

      Though the code in the second post is probably more resilient and less likely to break as Twitter changes and updates their code.
      Translations provided by Google.

      Wayne Luke
      The Rabid Badger - a vBulletin Cloud demonstration site.
      vBulletin 5 API

      Comment


      • #4
        Originally posted by Zips View Post
        Here's what we have for a custom Twitter embed code, maybe it'll help you.

        Code:
        <blockquote class="twitter-tweet" data-lang="en"><p lang="en" dir="ltr"><a href="https://twitter.com/twt/status/{param}">Embedded Tweet</a></blockquote>
        <script src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
        You put the Tweet ID in between the tags.

        Example: [tw]387657648666980352[/tw]

        Use {option}: Yes
        Remove tag if empty: No
        Disable BB code within this BB code: Yes
        Disable smilies: Yes
        Disable Word wrapping: Yes
        Disable Automatic link parsing: Yes
        Thanks, I'll take a look at this.

        Comment


        • #5
          Originally posted by Wayne Luke View Post
          The limit on the length of the replacement is actually 16MB. In some older versions there was a bug that would limit this to 200 characters. I don't believe that bug exists anymore and no changes to how Custom BBCode works is documented that I can see.

          What breaks in it?

          Though the code in the second post is probably more resilient and less likely to break as Twitter changes and updates their code.
          The Replacement preview is empty in the BB Code Manager and the post with the Tweet is empty as well.

          Comment


          • #6
            I was experimenting with Zips code and renamed my old bbcode instead of deleting it. It may be a coincidence, but the old code started working again. 🤷‍♀️

            I've saved Zips code in case the gremlins reappear. Thanks

            Comment

            Related Topics

            Collapse

            Working...
            X