• GitHub
  • Documentation
  • Discord
  • Donate
search
  • chevron_right Threads
  • label Dev Development

add a new function of 'markup_link_url' function

billy
July 6, 2023
chat_bubble_outline 12
  • link
    billy
    Members 17 posts
    July 6, 2023, 4:04 a.m. July 6, 2023, 4:04 a.m.
    link

    I noticed that it is possible to mark up a YouTube video by using the 'markup_link_url' function to input a YouTube link. Additionally, I would like to introduce a new matching rule similar to YouTube videos to accommodate different content from another platform. Therefore, I attempted to write some rules and related code in the '/frontend/src/services/one-box.js' file. However, I encountered difficulties in making it work successfully. Would you be able to assist me with this?

  • arrow_forward

    Thread has been moved from Feedback.

    • By rafalp on July 6, 2023, 4:57 p.m..
  • link
    rafalp
    Project Lead 1770 posts
    July 6, 2023, 5:15 p.m. July 6, 2023, 5:15 p.m.
    link

    Can you write what problem you are experiencing? My time is quite limited and I really can't afford to analyse large portions of code like that to guess myself where the problem is.

  • link
    billy
    Members 17 posts
    July 7, 2023, 12:36 a.m. July 7, 2023, 12:36 a.m.
    link

    Apologies, I'm just wondering whether I should write the related code in "one-box.js" or some other ".js" file to achieve a similar function of accepting a YouTube link as input.

    Thanks again.

  • link
    rafalp
    Project Lead 1770 posts
    July 7, 2023, 12:41 a.m. July 7, 2023, 12:41 a.m.
    link

    Currently the one-box.js is the way to do this. The logic for oneboxing is finding links that are only content of their paragraphs, checking if those links are YouTube video links, and if they are, replacing them with the HTML for the player.

  • link
    billy
    Members 17 posts
    July 7, 2023, 1:09 a.m. July 7, 2023, 1:09 a.m.
    link

    Yep, I also got this. I tried writing similar code to validate the link, but it didn't work successfully. It seems that besides coding correctly in 'one-box.js', there might be some other actions that need to be taken to make it work.

  • link
    rafalp
    Project Lead 1770 posts
    July 7, 2023, 3:33 p.m. July 7, 2023, 3:33 p.m.
    link

    but it didn't work successfully

    Why it didn't work? Did you get an error in browser's console?

  • link
    billy
    Members 17 posts
    July 7, 2023, 8:45 p.m. July 7, 2023, 8:45 p.m.
    link

    image.png

    image.png

    PNG, 800.5 KB, uploaded by billy on July 7, 2023.

  • link
    rafalp
    Project Lead 1770 posts
    July 7, 2023, 8:49 p.m. July 7, 2023, 8:49 p.m.
    link

    This is not where browser console displays JavaScript errors. Look at the "console" tab.

  • link
    billy
    Members 17 posts
    July 7, 2023, 8:57 p.m. July 7, 2023, 8:57 p.m.
    link

    There are no errors in the console, and I noticed that the markup action only loads the JavaScript file with 'http://localhost:8000/static/misago/js/misago.js', without including the code I wrote in 'one-box.js'. So I suspect that there should be a step to compile the code from 'one-box.js' into 'misago.js'.

    image.png

    misago-project.org/media/attachments/13/99/4q0TucEfYiADMGgkJd5x0Bqu8mailT1nv8fM7UNQiGO1jAYRpOQzcG9RPBfcNkl6/image.png

    image.png

    PNG, 702.5 KB, uploaded by billy on July 7, 2023.

  • link
    rafalp
    Project Lead 1770 posts
    July 8, 2023, 3:40 p.m. July 8, 2023, 3:40 p.m.
    link

    Thats because there is. See:

    • Plugin guide
    • HTML customization guide

    Those guides describe how to customize Misago’s JavaScript and make it use your customized version instead of standard one.

  • link
    billy
    Members 17 posts
    July 8, 2023, 7:33 p.m. July 8, 2023, 7:33 p.m.
    link

    I sincerely appreciate it!

  • link
    rafalp
    Project Lead 1770 posts
    July 9, 2023, 1:57 p.m. July 9, 2023, 1:57 p.m.
    link

    @billy please stop posting testing messages outside of testing category.

  • link
    billy
    Members 17 posts
    July 10, 2023, 3:59 a.m. July 10, 2023, 3:59 a.m.
    link

    yes, so sorry for that

arrow_upward Go to top
  • This site uses cookies to gather statistical data for use in traffic analysis. Header photo by Joanna Malinowska.
  • GitHub
  • Documentation
  • Discord
  • Donate
  • Terms of service
  • Privacy policy
powered by misago