MyBB Community Forums

Full Version: Table Generator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is a tweak of the 1.6* mod MyCode Table Generator to enable proper functionality on MyBB 1.8(.1).


You can get it here (pending approval) http://community.mybb.com/mods.php?action=view&pid=276

Or at Github https://github.com/p00lz/MyBB-Table-Generator



If you have smilies removed from beside your post boxes;
in newreply and newthread templates find:
<strong>{$lang->your_message}</strong>

Add this code after it (but before the </td>!)
<br /><!-- TableGenerator -->{$tabgen_button}<!-- /TableGenerator --><br />


Color will vary with your theme, but you get the gist.

[attachment=32853][attachment=32854][attachment=32855][attachment=32856]
Thread approved.
How to add table generator on edit post?
As on edit first post of thread or any post of thread, table generator button is not appearing?
please help.

This plugin is interfer by your code plugin.
As after activation of your code , table generator not working also.
- the pop up windows is kinda weird, you need maximize the window in order to spot the td tr buttons
- the checkboxes are kinda weird, whats the purpose of that
- there should be an "add to post" instead of copying..
- there should be limit of the width % so it doesn't get out of the postbit, "auto"?
Is it possible to insert line breaks in the code output?

As example the Code output is:

[table=95][tr][td]test1[/td][td]test2[/td][/tr][tr][td]test3[/td][td]test4[/td][/tr][/table]

I want to show my users the code as such:

[table=95]
[tr]
[td]test1[/td][td]test2[/td]
[/tr][tr]
[td]test3[/td][td]test4[/td]
[/tr]
[/table]

I found this in the tablegenerator.js

		var oldValue = $('#container').clone().html().replace(/\r\n|\r|\n/g, '') //new line
													.replace(/\t/g, '') //tab
													.replace(/<td><input type="checkbox"> TH<\/td>/g, '')
													.replace(/<td class="deleteMe"><\/td>/g, '')
													.replace(/<table>/g, '[table='+width+']')
													.replace(/<\/table>/g, '[\/table]')
													.replace(/<tr>/g, '[tr]')
													.replace(/<\/tr>/g, '[\/tr]')
													.replace(/<th>/g, '[th]')
													.replace(/<\/th>/g, '[\/th]')
													.replace(/<td>/g, '[td]')
													.replace(/<\/td>/g, '[\/td]')
													.replace(/<tbody>/g, '')
													.replace(/<\/tbody>/g, '');

Could I insert some /n/n or <br/> there somewhere?
^ of course, you can use \n just like replace(/\r\n|\r|\n/g, '')
(2020-02-15, 03:27 AM).m. Wrote: [ -> ]^ of course, you can use \n just like replace(/\r\n|\r|\n/g, '')

I tried, but it was not working. Maybe I did something wrong.

What I tried was

.replace(/<\/table>/g, '[\/table]\n\n')
^ oh! sorry.
try it like below [lines 90-97]
.replace(/<table>/g, '[table='+width+']\r\n')
.replace(/<\/table>/g, '[\/table]\r\n')
.replace(/<tr>/g, '[tr]\r\n')
.replace(/<\/tr>/g, '\r\n[\/tr]\r\n')
.replace(/<th>/g, '[th]\r\n')
.replace(/<\/th>/g, '[\/th]\r\n')
.replace(/<td>/g, '[td]')
.replace(/<\/td>/g, '[\/td]')