BBCode DatabaseGoogle Font BBcode

BBCode's
Previous topicNext topic
User avatar

Topic Author
Fast_Eddie
Users
Users
Status: Offline
User theme: Light
Posts: 279
Joined: Aug 15th, '15, 18:25
    Windows 7 Firefox

Google Font BBcode

Post by Fast_Eddie »

I have a working BBcode to use google fonts

BBcode:

Code: Select all

[googlefont={TEXT}]{TEXT2}[/googlefont]
HTML Replacement:

Code: Select all

<script type="text/javascript">
  WebFontConfig = {
    google: { families: [ '{TEXT}::latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })();</script><span style="font-family:{TEXT};">{TEXT2}</span>
Help Line:

Code: Select all

[googlefont=fontname][your text here][/googlefont]
Problem is when i submit I get this warning:

The BBCode you are trying to add seems to use a {TEXT} token inside a HTML attribute. This is a possible XSS security issue. Try using the more restrictive {SIMPLETEXT} or {INTTEXT} types instead. Only proceed if you understand the risks involved and you consider the use of {TEXT} absolutely unavoidable.

Can this be updated? How?
Thank you in advance! :buigen:
:beers: Retirement 2024!
User avatar

dmzx
Founder
Founder
Status: Online
User theme: Dark
Posts: 6292
Joined: Jan 13th, '14, 20:45
    Windows 10 Firefox

Re: Google Font BBcode

Post by dmzx »

Try this:

BBCode usage

Code: Select all

[googlefont={INTTEXT}]{INTTEXT2}[/googlefont]
HTML replacement

Code: Select all

<script type="text/javascript">
  WebFontConfig = {
    google: { families: [ '{INTTEXT}::latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })();</script><span style="font-family:{INTTEXT};">{INTTEXT2}</span>
Help line

Code: Select all

[googlefont=fontname][your text here][/googlefont]
User avatar

Topic Author
Fast_Eddie
Users
Users
Status: Offline
User theme: Light
Posts: 279
Joined: Aug 15th, '15, 18:25
    Windows 7 Firefox

Re: Google Font BBcode

Post by Fast_Eddie »

Thanks 'D' You 'da man! That did the trick :tumbsyes:
Previous topicNext topic