The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Enabling BBcodes

View previous topic View next topic Go down

Solved Enabling BBcodes

Post by Kamui on January 4th 2016, 10:18 pm

Hello,


I'm wondering if there's any way I can have additional BBcodes on my forum, and actually having them work, because I found a few on another site and liked their BBcodes. Only problem is I can't use them here even though my BB code is on. Sad


Examples:









Last edited by Kamui on January 5th 2016, 1:15 am; edited 1 time in total

Kamui
Forumember

Male Posts : 280
Reputation : 3
Language : English
Location : Greed Island

http://narutogaiden.forumotion.com/

Back to top Go down

Solved Re: Enabling BBcodes

Post by 10spetter10 on January 4th 2016, 11:23 pm

You can add bb-codes with this script from avacweb (added check and fieldset):

Code:
(function(){"LGBB, a Javascript BBCode parser and API. Copyright \u00a9 by AvacWeb 2011-2013. All Rights Reserved. Use of this script is not allowed without this entire copyright notice in place. No Distribution without authors consent.";var h={expando:"{LGBB:"+(new Date).getMilliseconds()+"}",bbcodes:{},basics:[],attrReg:/([\w-]+)=("|'|)(.*?)\2(?=[\s\]])/g,parseTag:function(a,b,c){for(var d=b.insensitive?"i":"",e="\\["+b.tag+"[^\\]]*?\\]",k="\\[\\/"+b.tag+"\\]",d=c?RegExp("("+e+")(?!.*"+e+")((?:.|[\\r\\n])*?)"+
k,d):RegExp(e,d),l=[];d.test(a);)a=a.replace(d,function(a,d,e){c||(d=a);var f={},g;for(g in b.defaultAttr)f[g]=b.defaultAttr[g];d=h.attrReg.test(d)?d.match(h.attrReg):[];if(d.length)for(var k=0;g=d[k++];)(a=/([\w-]+)=['"]?(.*?)['"]?$/.exec(g))&&a.length&&(a[1]===b.tag&&(a[1]="default"),f[a[1]]=a[2]);if(b.validate&&(c?!b.validate.call(b,e,f):!b.validate.call(b,f)))return l.push(a),h.expando;a=b.replacement;b.replace&&(g=c?b.replace.call(b,e,f):b.replace(f),"string"===typeof g?a=g:g&&"object"===typeof g&&
(e=g.content||e,f=g.attr||f,"string"===typeof f&&(f={"default":f})));return h.swapReplacers(a,e,f)});for(d=0;e=l[d++];)a=a.replace(h.expando,e);return a},swapReplacers:function(a,b,c){if(!a)return"";b||(b="");c||(c={});a=a.replace(/{CONTENT}/g,b);for(var d in c)a=a.replace(RegExp("{ATTR-"+d.toUpperCase()+"}","g"),c[d]);c["default"]&&(a=a.replace(/{ATTR}/g,c["default"]));return a.replace(/{ATTR(-[A-Z-]+)?}/g,"")},parse:function(a){var b=h.bbcodes,c=h.basics;h.expando="{LGBB:"+(new Date).getMilliseconds()+
"}";for(var d=0,e;e=c[d++];){var k=e[0];if("string"===typeof k&&-1===e[1].indexOf(k))for(;-1!==a.indexOf(k);)a=a.replace(k,e[1]);else a=a.replace(k,e[1])}for(var l in b)if(b.hasOwnProperty(l)&&(c=b[l])&&c.replacement&&c.tag)try{a=h.parseTag(a,c,c.close)}catch(m){console.log("LGBB: Error parsing "+c.tag+" tag.",m)}return a},add:function(a,b){if(!/^\w+$/.test(a))throw new Exception("Invalid LGBB tag name: "+a);b.tag||(b.tag=a);b.defaultAttr?"string"===typeof b.defaultAttr&&(b.defaultAttr={"default":b.defaultAttr}):
b.defaultAttr={};"close"in b||(b.close=!1);h.bbcodes[a]=b;return this},addSwap:function(a,b){h.basics.push([a,b]);return this}};window.LGBB=h})();

$(function(){
  var p = $('.postbody');
  for(var i = 0, post; (post = p[ i++ ]); ) {
      var codes = post.getElementsByTagName('code'), store = [];
      for(var j = 0, c; (c = codes[j++]); ) {
        store.push(c.innerHTML);
        c.innerHTML = '';
      }
      post.innerHTML = LGBB.parse( post.innerHTML );
      for(var s, j = 0; (s = store[j]); ) codes[j++].innerHTML = s;
  }
});

LGBB.add('CHECK', {
  close : true,
  replacement : '<p class="bb-check {ATTR}">{CONTENT}</p>'
});
LGBB.add('fieldset', {
  close : true,
  replacement : '<div class="bb-fieldset" alt="{ATTR}">{CONTENT}</div>'
});
info about the script

Add this script to your javascripts and choose 'on all pages'.

corresponding css:
Code:
p.bb-check {
  padding-left: 15px;
}
p.bb-check.dot {
  background: url(http://i.imgur.com/TOuzEWZ.png) no-repeat 0px;
}
p.bb-check.check {
  background: url(http://i.imgur.com/Cgj53cJ.png) no-repeat 0px;
}
p.bb-check.cross {
  background: url(http://i.imgur.com/tmWjMA2.gif) no-repeat 0px;
}
div.bb-fieldset {
  border: 1px solid black;
  padding: 15px 7px 5px 7px;
  position: relative;
}
div.bb-fieldset:before, div.bb-fieldset::before  {
  content: attr(alt);
  position: absolute;
  top: -10px;
  font-size: 12px;
  background: white;
  padding: 0px 3px;
}

result:

10spetter10
Forumember

Posts : 195
Reputation : 81
Language : Dutch

Back to top Go down

Solved Re: Enabling BBcodes

Post by Kamui on January 5th 2016, 12:10 am

Not working, plus it messes up my other codes

Kamui
Forumember

Male Posts : 280
Reputation : 3
Language : English
Location : Greed Island

http://narutogaiden.forumotion.com/

Back to top Go down

Solved Re: Enabling BBcodes

Post by brandon_g on January 5th 2016, 12:52 am

Hello,

Unfornatelly I do not believe there is any other to do this, as things like more bbcodes, etc need to be done serverside. Since forumotion is a free hosting provider and each forum works off of the FM server(s) and not off of private servers, there is really no other way to accomplish this, sorry. Sad

-Brandon


Remember to mark your topic when a solution is found.

brandon_g
Support Moderator
Support Moderator

Male Posts : 5143
Reputation : 478
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

Solved Re: Enabling BBcodes

Post by Kamui on January 5th 2016, 1:14 am

Okay, thank you.

Kamui
Forumember

Male Posts : 280
Reputation : 3
Language : English
Location : Greed Island

http://narutogaiden.forumotion.com/

Back to top Go down

Solved Re: Enabling BBcodes

Post by brandon_g on January 5th 2016, 1:27 am

Your welcome anytime, sorry we couldn't provide more help Sad.

Topic solved and archived ~ brandon_g


Remember to mark your topic when a solution is found.

brandon_g
Support Moderator
Support Moderator

Male Posts : 5143
Reputation : 478
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum