[XF] Code

xF2 Add-on [XF] Code 2.2.0

No permission to download
📀 Resource submitted by: AnimeHaxor • 💬 Messages: 6522 • 🏆 Points: 113 • 👍 Likes: 40593 • 📀 Resources: 2252
Compatible XF Versions
  1. 2.0
  2. 2.1
  3. 2.2
Additional Requirements
For 2.1+ versions:
• XenForo 2.1
• PHP 7 +
codelogotype-png.182661



Description

This addon makes code bbcode and code editor way more functional by adding copy, expand, collapse buttons, resizer bar and automatically adjusting the colors to fit chosen forum style.

___

Features


func_features-png.182662



Custom title

You can now specify a custom code block header title. For example, users can provide a filename for code blocks instead of writing it in the text or putting the whole code block inside a spoiler with filename title.

Custom title can be set via "Insert code" dialog:

code_block_title-png.182664



You can also set the title directly in text editor by putting | charater and title text after language name in code bbcode.

Example: [code=php|My Custom Title]<? .... ?>[/code] will produce this codeblock:

1535718915924-png.182669



Hovering custom title will show the code language:

1535719001075-png.182670



Expand/Collapse buttons

Three new buttons are available at the top right of code block: expand, collapse and copy.
  • Expand button smoothly increasing the height of code block until all the code is showing. It is visible only when code block height is LESS than the actual code size.
  • Collapse button smoothly decreasing the height of code block to it's default height which you can set in style properties. It is visible only when code block height is LARGER than the actual code size.
expand-collapse-gif.182671



Both expand and collapse buttons are visible when code block height is within min and max limits and invisible on code blocks that are smaller than default code block height.

The default height of code block can be set in style properties ("Code" section below "Messages"):

1535723219891-png.182677



Copy button

Copy button simply copy the code right into your clipboard:

copy-gif.182673



Line numbers

All code blocks have line numbers (up to 1000 lines). Line numbers can be turned off via style properties:

1535721681160-png.182674



Resizer

Every code block which code height is larger than the default height has a resizer bar. It allows users to vertically resize code block:

resizer-gif.182675



Common languages

I always thought there is something wrong about "Common languages". Why can't we set which languages are "common" to our specific forum? Weird...

With Code addon you can now set common languages right after "Allowed code languages" option in "Messages" option-group:

1535723658651-png.182678



Hurray!

1535723826755-png.182681



Default language

You can also set a default language code for "Insert code" dialog via "Default code language" option after common languages in "Messages" option-group:

1535743202787-png.182689



Adaptive style

Code block colors and properties are not defined directly (hardcoded) — they inherit from forum style variables.

What does this mean?

It means that code blocks and all its parts (including scrollbars!) will be looking great automatically no matter what style/color palette forum is using.

However, you have to manually set code style type: light (by default) or dark depending on general style type of your forum:

1535744407707-png.182694



This is how a code block will look like on the forum with dark theme:

1535744921126-png.182696



___

Installation

  1. Download the addon
  2. Upload contents of upload folder to your forum root
  3. In admin control panel go to "Addons" section and install Code
Unistallation

WARNING: after unistalling all code blocks with custom titles will have an incorrect highlighting or will not be highlighted at all!
  1. Uninstall the addon from ACP
  2. Go to forum root folder and remove js/Code folder.
Author
AnimeHaxor
Size
27.4 KB
Extension
zip
Downloads
26
Views
1,295
First release
Last update

More resources from AnimeHaxor

Latest updates

  1. Update 2.2.0

    Features An option to set a default code language for all code block on the forum without...
  2. Hotfix 2.1.2

    Fixes a problem with upgrading. If any other errors happen, try to fully remove the addon. Than...
  3. Bug fixes 2.1.1

    Fixed bugs Fixed an ACP error when XF sends an email notification about new post in the thread...

Similar resources

Adding Select All for [code] BBcode Admin
A simple template modification in order to select all the text inside the [code] bbcode.
Change the default behaviour of CODE boxes to match vBulletin 3/4 with CODE=Rich as default.
Editor & BB Code Manager Admin
xF2 Add-on Editor & BB Code Manager 2.0.1 Patch Level 1
Customize Your WYSIWYG-Editor & BbCodes. Take full control over your BB codes and rich text editor.
Add all available languages to the [code] syntax highlighting
ITD Archive.org BB Code Media Site Admin
Embed Audios, Videos, Books and Games from Archive.org

741Threads
2,309Messages
67,556Members
uosofLatest member
Back