inherit
268176
0
Jul 13, 2023 10:47:11 GMT -8
vixeyjax
Hello!
2
July 2023
vixeyjax
|
Post by vixeyjax on Jul 13, 2023 7:21:32 GMT -8
I'm sure there's plenty you can do, but the only functionality i've been able to find documentation before is everything listed in the JS API page, which helps a bit, but I really don't understand how to use the rest of the api. I want to make a plugin that will check if a user made a post that contains a certain link, and add an embed for that link, but I really don't see any documentation for doing any of that. tl;dr: What can (and can't) plugins do?
|
|
inherit
6871
0
Jun 10, 2024 2:25:35 GMT -8
bigballofyarn
"If you wish to make an apple pie from scratch, you must first invent the universe." -Carl Sagan
7,887
January 2003
bigballofyarn
|
Post by bigballofyarn on Jul 13, 2023 8:42:40 GMT -8
Did you try searching for that link/post by using your forum's search feature? No plugin is required to search for topics or posts.
|
|
inherit
268176
0
Jul 13, 2023 10:47:11 GMT -8
vixeyjax
Hello!
2
July 2023
vixeyjax
|
Post by vixeyjax on Jul 13, 2023 8:51:38 GMT -8
Did you try searching for that link/post by using your forum's search feature? No plugin is required to search for topics or posts. Sorry should clarify, what I want to do is add an embed within the post that only shows up if the link is present
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 13, 2023 11:52:34 GMT -8
I'm sure there's plenty you can do, but the only functionality i've been able to find documentation before is everything listed in the JS API page, which helps a bit, but I really don't understand how to use the rest of the api. I want to make a plugin that will check if a user made a post that contains a certain link, and add an embed for that link, but I really don't see any documentation for doing any of that. tl;dr: What can (and can't) plugins do? Plugins can do anything a JavaScript, CSS, and HTML file can do when the browser processes them. Plugins live in the browser and have very limited interaction with the server that hosts the forum. The server sends metadata with the page and that is generally what a plugin uses as its data set. The communication a plugin can hold with the Proboards server is dictated by the published API and the Developer Guidelines. The v5 JS API page details the API that is public-facing, and you are free to use. The internal stuff is not sanctioned for public consumption Hello everyone, Over the past few days I've been made aware of some various plugins that use certain ProBoards functions that they should not. Please remember that any code that generates AJAX requests to our servers is prohibited unless we explicitly allow it (which right now is limited to plugin set() functions). If you want special permission to generate an AJAX call, please ask me directly and explain your use case. One example of where developers have gone wrong is codes that switch the WYSIWYG editor between Visual and BBCode mode. There are some codes that are triggering Visual -> BBCode -> Visual which generates two AJAX requests to our servers. Please remember that just because you have found one of ProBoards' private functions in our JavaScript, that does not necessarily mean you can use it in your codes if they can generate calls to our servers. Thank you Patrick Quick links
The documentation of the API has been criticized for being sparse, and rightfully so, and until PBv6 was placed on hold a much-improved v6 documentation was in the works. I would suggest giving the v6 docs a look, but caution that it will also contain things not applicable to v5. If you are puzzled about something in v5, you can compare what you find in the partial v6 doc and most likely gain a better understanding. For your particular use case, you would not need any API calls at all since your plugin runs in the browser as the page is being loaded. The majority of plugin tasks are done using JavaScript. You can simply iterate over each post, looking for the pattern you wish to target, and do whatever you want whenever you find that pattern. Here are two open-source plugins that pretty much create embeds from URLs found within a post: - View in Post
- TikTok
A couple tips that might smooth the way: - It is much better to target an actual anchor link in the post rather than searching through the hundreds of textNodes within a post to identify an URL pattern. TextNodes can be split for any reason[1], so there are no guarantees you would be able to 100% identify all URLs using this method.
- Using a sledgehammer such as innerHTML with some regex would be quick and dirty but also interfere with any event handlers already set in place by other codes/plugins as well as run the risk of running malicious code that may be present in the content
|
|