SA-MP Forums

Go Back   SA-MP Forums > SA-MP > General

Reply
 
Thread Tools Display Modes
Old 07/07/2018, 12:42 PM   #1
Y_Less
Spam Machine
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,809
Reputation: 3111
Default Forum Enhancer

Forum Enhancer

Introduction

This Greasemonkey/Tampermoney script allows you to write forum posts in markdown, with full pawn syntax highlighting automatically. It also supports ctrl+enter to submit, and tabbing within text for indentation.

Download

https://openuserjs.org/scripts/y-les...Forum_Enhancer

Note that this is a “user script”, a script that enhances a website from the browser directly. Thus you will need one of the addons used to run these scripts:

Firefox (tested): https://addons.mozilla.org/en-GB/fir.../tampermonkey/

Chrome (not tested): https://chrome.******.com/webstore/d...jmpbldmpobfkfo

For more information and other browsers see this link:

https://openuserjs.org/about/Userscript-Beginners-HOWTO

Background

Southclaws got sick of writing BB code (and who can blame him), so wrote forumfmt to convert markdown in to BB code. This was originally written as an offline tool to convert documentation from github in to something that could be posted on the forums. However, I decided I wanted it more integrated so wrote this script to intercept post submissions, translate the text with the tool, and then submit that adjusted code instead.

What’s wrong with BB code? Well simply it isn’t widely used. If you write documentation on github, you’ll use markdown. If you write things on discord, you use markdown. It makes sense to be able to use the same code everywhere. Also, the [pawn] tags are broken on the forums, and didn’t support common keywords like foreach anyway.

Usage

Usage it very simple. When you make a post on the forums, use markdown instead of BB code. When you click post, or hit ctrl+enter (because tab no longer moves to the control) the text is converted and submitted.

You can also use tab as in code editors - including block indentation and unindentation of multiple selected lines.

Editing

Unfortunately, currently if you try edit a post you will only see the generated BB code, not the original markdown. Thus, I suggest you keep a backup somewhere and edit and re-paste that version. This isn’t hard if you are keeping documentation synced between the forums and github, since github will have the original still. Also, for some reason sometimes the “edit” screen doesn’t get the enhancement, I don’t know why, but just press F5 and it will be fine.

Markdown

For more information on markdown, there are hundreds of sites with more documentation. But for a brief example, this:

# Main heading

## Second heading

```
code
```

```pawn
// syntax-highlighted PAWN code (with extensions)
foreach (new i : Player)
{
if (i > 5)
printf("%d", i);
}
```

* **Bold list item 1**
* *Italic list item 2*
* List item 3 with `inline code`


Gives:

Main heading

Second heading

code


Code:
// syntax-highlighted PAWN code (with extensions)
foreach (new i : Player)
{
    if (i > 5)
        printf("%d", i);
}
  • Bold list item 1
  • Italic list item 2
  • List item 3 with inline code
Y_Less is offline   Reply With Quote
Old 07/07/2018, 12:51 PM   #2
Eoussama
High-roller
 
Eoussama's Avatar
 
Join Date: Jul 2016
Location: Kingdom of Morocco // Tangier
Posts: 1,263
Reputation: 227
Default Re: Forum Enhancer

Splendid! makes you hungry to write some tutorials, I got sick from manual setting colors to pawn keywords in my tutorials. +REP.
__________________

|===[Web taxi]===|
List of my work
Github
Pastebin

|===[Interesting topics]===|
Semantic Versioning



Last edited by Eoussama; 07/07/2018 at 01:28 PM.
Eoussama is online now   Reply With Quote
Old 07/07/2018, 12:59 PM   #3
SoFahim
Gangsta
 
SoFahim's Avatar
 
Join Date: May 2015
Location: Bangladesh.
Posts: 945
Reputation: 82
Default Re: Forum Enhancer

Another great done by Y_less <3
REP+
__________________
Senior Developer & Mapping manager of SARP

You can contact me at Discord, my ID: Gold#8839
Quote:
SoFahim is offline   Reply With Quote
Old 07/07/2018, 01:06 PM   #4
Alex Magaña
High-roller
 
Alex Magaña's Avatar
 
Join Date: Oct 2012
Location: 𝕭𝖗𝖔𝖙𝖍𝖊𝖗𝖍𝖔𝖔𝖉
Posts: 2,450
Reputation: 211
Default Re: Forum Enhancer

The whole point of Markdowns looks interesting and useful. Bravo Y-Less once again .
__________________


Alex Magaña is offline   Reply With Quote
Old 07/07/2018, 01:18 PM   #5
Dayrion
High-roller
 
Dayrion's Avatar
 
Join Date: Jan 2016
Location: France
Posts: 1,834
Reputation: 252
Default Re: Forum Enhancer

Niiice. There is some problems. We can’t preview a message, it post it automatically. Plus, it doesn’t seems to detect pawn syntax when you write natives.

Example:

Code:
native Attach3DTextLabelToActor(actorid, text[], color, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:drawdistance, virtualworld = DEFAULT_ACTOR_VALUE, testlos = 0, bool:store_string = true);
native SetActorInvulnerable(actorid, invulnerable = true); // Force actor re-stream
native SetActorVirtualWorld(actorid, vworld); // Force actor re-stream
native SetActorFacingAngle(actorid, Float:ang); // Force actor re-stream
native CountStaticActors();
Edit: editing an converts markdown code to bbcode converts it again to something glitched.
Code:
 native Attach[COLOR=“Purple”]3[/COLOR]DTextLabelToActor(actorid, text[], color, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:drawdistance, virtualworld = DEFAULT_ACTOR_VALUE, testlos = [COLOR=“Purple”]0[/COLOR], bool:store_string = true); native SetActorInvulnerable(actorid, invulnerable = true); [COLOR=“Green”]// Force actor re-stream[/COLOR] native SetActorVirtualWorld(actorid, vworld); [COLOR=“Green”]// Force actor re-stream[/COLOR] native SetActorFacingAngle(actorid, Float:ang); [COLOR=“Green”]// Force actor re-stream[/COLOR] native CountStaticActors();
__________________
actor_plus - v5.0.0
« I'm a goner, somebody catch my breath,
I'm a goner, somebody catch my breath »
Dayrion is offline   Reply With Quote
Old 07/07/2018, 02:04 PM   #6
Uproar
Gangsta
 
Uproar's Avatar
 
Join Date: Feb 2018
Location: India
Posts: 560
Reputation: 118
Default Re: Forum Enhancer

Splendid work, once again!
__________________
Uproar is offline   Reply With Quote
Old 18/07/2018, 10:17 AM   #7
Zeth
Huge Clucker
 
Zeth's Avatar
 
Join Date: Feb 2017
Location: India
Posts: 479
Reputation: 90
Default Re: Forum Enhancer

Woah cool release, I've been already using it for a month now. DOPE AS ALWAYS.
__________________
Zeth is offline   Reply With Quote
Old 18/07/2018, 10:41 AM   #8
Y_Less
Spam Machine
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,809
Reputation: 3111
Default Re: Forum Enhancer

Quote:
Originally Posted by Dayrion View Post
Niiice. There is some problems. We can’t preview a message, it post it automatically.
Yeah, I discovered that very late on sorry.

Quote:
Originally Posted by Dayrion View Post
Plus, it doesn’t seems to detect pawn syntax when you write natives.

Example:
That's an issue with the style not the system. It isn't addressed at all here, but if you check the original forumfmt code you'll see you can have custom styles.

Quote:
Originally Posted by Dayrion View Post
Edit: editing an converts markdown code to bbcode converts it again to something glitched.
Code:
 native Attach[COLOR=“Purple”]3[/COLOR]DTextLabelToActor(actorid, text[], color, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:drawdistance, virtualworld = DEFAULT_ACTOR_VALUE, testlos = [COLOR=“Purple”]0[/COLOR], bool:store_string = true); native SetActorInvulnerable(actorid, invulnerable = true); [COLOR=“Green”]// Force actor re-stream[/COLOR] native SetActorVirtualWorld(actorid, vworld); [COLOR=“Green”]// Force actor re-stream[/COLOR] native SetActorFacingAngle(actorid, Float:ang); [COLOR=“Green”]// Force actor re-stream[/COLOR] native CountStaticActors();
I addressed that in the first post.

Quote:
Originally Posted by Uproar View Post
Splendid work, once again!
Quote:
Originally Posted by Zeth View Post
Woah cool release, I've been already using it for a month now. DOPE AS ALWAYS.
Thanks
Y_Less is offline   Reply With Quote
Old 18/07/2018, 11:23 AM   #9
Dystans
Big Clucker
 
Dystans's Avatar
 
Join Date: May 2010
Location: Poland
Posts: 77
Reputation: 32
Default Re: Forum Enhancer

Great work (again), but I have a question - can you (at least try to) add a "greater-than" sign to this script? I mean - on some forums, like Reddit or... Reddit, or other 4chans, you can use the ">" symbol to quote something.
I.E.:
Quote:
> This is just a random quote
Is it possible to do that?

Oh, and btw, I've got a nice message in a window "Could not retrieve BB code:" and there wasn't any bbcode below. Not sure what happened and if this is caused by your script or by forum js but it happened to me when I tried to use the ">" symbol to show an example quote. Even F5 key didn't help so I had to temporarily disable my greasemonkey just to edit this message.
__________________
Thug 4 Life
Dystans is offline   Reply With Quote
Old 18/07/2018, 01:16 PM   #10
Y_Less
Spam Machine
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 14,809
Reputation: 3111
Default Re: Forum Enhancer

Quotes are useful, I'll look in to that - it just depends on the go markdown library. As for BB code, that is what is being generated, so if it can't be retrieved it means the server failed for some reason.
Y_Less is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server ad forum [about samp forum] Dorlevi1506 General 1 21/11/2013 11:21 AM


All times are GMT. The time now is 05:41 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.