Page Index Toggle Pages: 1 ReplyAdd Poll Send Topic
Normal Topic New Features - BoardMod hooks (Read 2818 times)
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
New Features - BoardMod hooks
Aug 13th, 2014 at 9:23pm
Mark & QuoteQuote  
ManageBoards.pm, Load.pm and PostBox.pm have been refactored to add 'hooks' specifically for BoardMod additions.

When adding additional buttons to the UBBC array, you don't need to recalculate the div widths or positioning. The new mod buttons will automatically go into a div between the UBBC array and the Googiespell link. Those buttons will auto position themselves into two rows. (Note that the buttons must be uploaded into yabbfiles/ModImages to be found.)

For instance SpoilerTag_260_01.mod now looks like:
Code
Select All
<id>
 Spoiler Tag for YaBB 2.6.0
 </id>

 <version>
 2.1
 </version>

 Files to edit
 Admin/ModList.pm
 Languages/English/InstantMessage.lng
 Languages/English/Main.lng
 Languages/English/Post.lng
 Sources/InstantMessage.pm
 Sources/MyCenter.pm
 Sources/PostBox.pm
 Sources/Printpage.pm
 Sources/YaBBC.pm

 ubbc.js

 default.css
 </mod info>

 <author>
 Derek Barnstorm, updated for 2.6.0 by Dandello
 </author>

 <homepage>
 http://yabbforumsoftware.com
 </homepage>

 <edit file>
 Admin/ModList.pm
 </edit file>

 <search for>
 ### END BOARDMOD ANCHOR ###
 </search for>

 <add before>
     $spoiler_mod = "Spoiler Tag|Derek Barnstorm, updated for 2.6.0 by Dandello|Adds Spoiler Tag to YaBB|2.1|29th June 2014";
     push (@installed_mods, "$spoiler_mod");
 </add before>

 <edit file>
 Languages/English/ContextHelp.lng
 </edit file>

 <search for>
 'noparse' => "No Parse:<br /><br />Select the YaBBC Code:<br />[SELECT]
This table will not be parsed
[/SELECT]<br /><br />Click on the \"[TITLE]\" button: [BUTTON]<br /><br /><b>YaBBC Code:</b><br />[table][tr][td]This table will not be parsed[/td][/tr][/table]<br /><br /><b>Result:</b><br />
This table will not be parsed
"); </search for> <add before> 'spoiler' => "Hide spoilers or warnings:<br /><br />Select the text: bla bla [SELECT]Hello World[/SELECT] bla bla<br /><br />Click on the \"[TITLE]\" button: [BUTTON]<br /><br /><b>YaBBC Code:</b> bla bla
Spoiler:
Hello World
bla bla<br /><br /><b>Result:</b> bla bla
Spoiler:
Hello World
bla bla", </add before> <search for> 'right', '$contextxt{'right'}', </search for> <add after> 'spoiler', '$contextxt{'spoiler'}', </add after> <search for> 1; </search for> <add before> ## spoiler text %spoiler_txt =( '01' => 'Spoiler', '02' => 'Show', '03' => 'Hide', '04' => 'for', '05' => 'Insert Spoiler', ); </add before> <edit file> Languages/English/InstantMessage.lng </edit file> <search for> '84' => 'Code Ripped out', </search for> <add after> '85' => 'Spoiler Ripped out', </add after> <edit file> Languages/English/Main.lng </edit file> <search for> 1; </search for> <add before> ## spoiler text %spoiler_txt =( '01' => 'Spoiler', '02' => 'Show', '03' => 'Hide', '04' => 'for', ); </add before> <edit file> Languages/English/Post.lng </edit file> <search for> 1; </search for> <add before> ## spoiler text %spoiler_txt =( '01' => 'Spoiler', '02' => 'Show', '03' => 'Hide', '04' => 'for', '05' => 'Insert Spoiler', ); </add before> <edit file> Sources/ContextHelp.pm </edit file> <search for> LoadLanguage('ContextHelp'); </search for> <add after> my $spoil1 = $spoiler_txt{'01'}; my $spoil2 = $spoiler_txt{'02'}; my $spoil3 = $spoiler_txt{'03'}; </add after> <search for> document.getElementById("contexttitle").innerHTML = contextimage + ' ' + contitle; </search for> <add before> contexthelp = contexthelp.replace(/\\[SPOILER\\](.*?)\\[\\/SPOILER\\]/g, '<div class=\"message\"><div style=\"padding-bottom: 1px;\"><b> $spoil1</b>: <input type=\"button\" class=\"button\" value=\"$spoil3\"></div><div class=\"spoiler\"><div> \$1</div></div></div><br /><div class=\"message\"><div style=\"padding-bottom: 1px;\"><b> $spoil1</b>: <input type=\"button\" class=\"button\" value=\"$spoil2\"></div><div class=\"spoiler\"><div style=\"display:none\"> \$1</div></div></div>'); </add before> <edit file> Sources/PostBox.pm </edit file> <search for> ); ## Mod Hook for UBBC ## </search for> <add before> 'spoiler' => "spoiler.gif|spoiler()|$spoiler_txt{'05'}", </add before> <edit file> Sources/MyCenter.pm </edit file> <search for> undef $quotecount; undef $codecount; </search for> <add after> undef $spoilercount; </add after> <search for> $quoteimg = q{}; $codeimg = q{}; </search for> <add after> $spoilerimg = q{}; </add after> <search for> if ( $immessage =~ /\[code\s*(.*?)\]/isgm ) { $codeimg = qq~<img src="$imagesdir/$IM_code1" alt="$inmes_imtxt{'84'}" title="$inmes_imtxt{'84'}" />&nbsp;~; $immessage =~ s/\[code\s*(.*?)\](.+?)\[\/code\]//igsm; } </search for> <add after> if ( $immessage =~ /\[spoiler\]/isgm ) { $spoilerimg = qq~<img src="$imagesdir\/spoiler1.gif" alt="$inmes_imtxt{'85'}" title="$inmes_imtxt{'85'}" \/>&nbsp;~; $immessage =~ s/\[spoiler\](.+?)\[\/spoiler\]//igsm; } if ($immessage =~ /\[spoiler=([A-Za-z0-9# -,.]+)\]/isgm) { $spoilerimg = qq~<img src="$imagesdir\/spoiler1.gif" alt="$inmes_imtxt{'85'}" title="$inmes_imtxt{'85'}" \/>&nbsp;~; $immessage =~ s/\[spoiler=([A-Za-z0-9# -,.]+)\](.+?)\[\/spoiler\]//igsm; } </add after> <search for> $immessage = qq~$quoteimg$codeimg $immessage~; </search for> <replace> $immessage = qq~$quoteimg$codeimg$spoilerimg $immessage~; </replace> <edit file> Sources/Printpage.pm </edit file> <search for> $threadpost =~ s/\[move\](.*?)\[\/move\]/$1/isgxm; </search for> <add after> $threadpost =~ s~\[spoiler\](.+?)\[/spoiler\]~<div class="message"><div style="padding-bottom: 1px;"><b>$spoiler_txt{'01'}:</b> <input type="button" class="button" value="$spoiler_txt{'02'}" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.value = '$spoiler_txt{'03'}'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = '$spoiler_txt{'02'}'; }"></div><div class="spoiler"><div style="display: none;">$1</div></div></div>~isgm; $threadpost =~ s~\[spoiler=([A-Za-z0-9# -,.]+)\](.+?)\[/spoiler\]~<div class="message"><div style="padding-bottom: 1px;"><b>$spoiler_txt{'01'}</b> $spoiler_txt{'04'} <i>$1</i>: <input type="button" class="button" value="$spoiler_txt{'02'}" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.value = '$spoiler_txt{'03'}'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = '$spoiler_txt{'02'}'; }"></div><div class="spoiler"><div style="display: none;">$2</div></div></div>~isgm; </add after> <edit file> Sources/YaBBC.pm </edit file> <search for> $message =~ s/( |&nbsp;)*\[move\](.*?)\[\/move\]/<marquee>$2<\/marquee>/isgm; </search for> <add after> $message =~ s~\[spoiler\](.+?)\[/spoiler\]~<div class="message"><div style="padding-bottom: 1px;"><b>$spoiler_txt{'01'}:</b> <input type="button" class="button" value="$spoiler_txt{'02'}" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.value = '$spoiler_txt{'03'}'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = '$spoiler_txt{'02'}'; }"></div><div class="spoiler"><div style="display: none;">$1</div></div></div>~isgm; $message =~ s~\[spoiler=([A-Za-z0-9# -,.]+)\](.+?)\[/spoiler\]~<div class="message"><div style="padding-bottom: 1px;"><b>$spoiler_txt{'01'}</b> $spoiler_txt{'04'} <i>$1</i>: <input type="button" class="button" value="$spoiler_txt{'02'}" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.value = '$spoiler_txt{'03'}'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = '$spoiler_txt{'02'}'; }"></div><div class="spoiler"><div style="display: none;">$2</div></div></div>~isgm; </add after> <edit file> ..\..\public_html\yabbfiles\ubbc.js </edit file> <search for> function move() { AddSelText("
","
"); } </search for> <add after> function spoiler() { AddSelText("
Spoiler:
","
"); } </add after> <edit file> ..\..\public_html\yabbfiles\Templates\Forum\default.css </edit file> <search for> .editbg { background-color: #fffedf; border: 1px #c00 solid; color: #000; font-family: Verdana, Helvetica, Arial, Sans-Serif; font-size: 11px; font-style: normal; font-weight: 400; padding: 4px; width: 90%; } </search for> <add after> .spoiler { font-size: 12px; font-weight: normal; font-style: normal; font-family: Verdana, Helvetica, Arial, Sans-Serif; color: #304B58; border: 1px inset; width: 90%; padding: 4px; } </add after>
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: New Features - BoardMod hooks
Reply #1 - Aug 13th, 2014 at 9:36pm
Mark & QuoteQuote  
More:
Code
Select All
<search for>
     );
     ## Mod Hook for UBBC ##
 </search for>

 <add before>
             'spoiler' => "spoiler.gif|spoiler()|$spoiler_txt{'05'}",
 </add before> 


The key (the item to the left of the '=>') needs to be a unique identifier. The list to the right consists of the name of the button in ModImages, the javascript call for it to work and the language file variable for the alt and title tags, all separated by the '|' symbol. The string needs to end with a comma so that when another item is added, the hash doesn't break.

I should have some refactored mods uploaded sometime tomorrow.

The biggest thing these changes do is eliminate the need for multiple mods when there are conflicts. This should eliminate most, if not all, of those conflicts.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: New Features - BoardMod hooks
Reply #2 - Aug 13th, 2014 at 9:44pm
Mark & QuoteQuote  
If you know of other spots where adding an explicit hook for BoardMod would make sense, let me know.

Most of the existing mods shouldn't require rewriting as few of them add buttons to the UBBC array or add items to forum.control.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Batchman
Full Member
***
Offline


I Love YaBB!

Posts: 165
Location: Somewhere just East of Crazy
Joined: Jul 25th, 2014
Gender: Male
Mood: Depressed
Zodiac sign: Libra
Re: New Features - BoardMod hooks
Reply #3 - Aug 14th, 2014 at 7:10am
Mark & QuoteQuote  
Dandello ... you just may be absolutely brilliant!
  

If you don't know where you are, but you don't care, you're not lost ... you're exploring!
Back to top
 
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: New Features - BoardMod hooks
Reply #4 - Aug 16th, 2014 at 3:30pm
Mark & QuoteQuote  
In MyProfile.template the lists of '{yabb ...}' are now vertical to make it easier to insert mods into user Profiles.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
ReplyAdd Poll Send Topic
Bookmarks: del.icio.us Digg Facebook Google LinkedIn reddit Twitter Yahoo
New Features - BoardMod hooks

Please type the characters exactly as they appear in the image,
without the first 2 and last 2 characters.
The characters must be typed in the same order,
and they are case-sensitive.
Open Preview Preview

You can resize the textbox by dragging the right or bottom border.
Off Topic Comment Insert Spoiler
Insert Hyperlink Insert FTP Link Insert Image Insert E-mail Insert Media Insert Table Insert Table Row Insert Table Column Insert Horizontal Rule Insert Teletype Insert Code Insert Quote Edited Superscript Subscript Insert List /me - my name Insert Marquee Insert Timestamp No Parse
Bold Italicized Underline Insert Strikethrough Highlight
                       
Change Text Color
Insert Preformatted Text Left Align Centered Right Align
resize_wb
resize_hb







Max 5000 characters. Remaining characters:
Text size: %
More Smilies
View All Smilies
Collapse additional features Collapse/Expand additional features Smiley Wink Cheesy Grin Angry Sad Shocked Cool Huh Roll Eyes Tongue Embarrassed Lips Sealed Undecided Kiss Cry