News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Where to add a script (GWBBCode)

Started by nemwar, July 25, 2022, 09:44:20 AM

Previous topic - Next topic

nemwar

Hello,

not new to SMF, but because of a new project i wanna start a new forum ... of course with SMF2.1, as it is the latest version.

The old GWBBCode Modification was for SMF1.1 but meanwhile somebody programmed this from the scratch as a Javascript.

So... now my problem... where i have to add the Code-Snippet to get this to work?

<script type="text/javascript" src="https://gwbbcode.arnapou.net/gwbbcode/api.js"></script>
<script type="text/javascript" >
    GWConfig.lang = 'de'; // oder 'en'
    GWOnLoad(Funktion(){
    GWBBCodeParse('.post_body, .postbody');
    });
</script>

Before i begin to work with SMF, some Modifications this should work first.

I hosted the fully site here (if you wanna take a look): http://gw4ever.bplaced.net/

Thanks for your time and help.

NemWar

You like Guild Wars?
You still play Guild Wars?
Then you may like to visit my website:
Guild Wars Characters Reloaded

Arantor

The logical place for this would be in your theme's index.template.php, in just before the </body> tag - though you'll need to be careful about the single quotes because SMF uses single quotes too. In your case they can all be replaced with double quotes.

It would also be possible to write this as a proper add-on that doesn't require file edits but as a 'just getting it running' step I think it would be simpler to just edit the theme.

Also note that in 2.1 the markup is a bit different and I think your selector should be ".postarea .post" rather than ".post_body, .postbody" assuming the point is to target the content of a post.

nemwar

Thanks for your help @Arantor.

I will try your changes and add it.
Would love to see an add-on but i'm no programmer nor can i progamm.

I will also let you know if it works.


You like Guild Wars?
You still play Guild Wars?
Then you may like to visit my website:
Guild Wars Characters Reloaded

Doug Heffernan

Quote from: nemwar on July 26, 2022, 02:35:53 AMWould love to see an add-on but i'm no programmer nor can i progamm.

You can request it at our Mod Request board:

https://www.simplemachines.org/community/index.php?board=79.0

Arantor

I'll be honest, I didn't realise folks were still running forums for Guild Wars 1, seeing that the game is mostly on life support (though I really must finish the Flameseeker Prophecies sometime, rather enjoyed Nightfall and Factions, and it was jarring to see how much of Nightfall was retrodden during GW2 Path of Fire, I though End of Dragons was a better retread of Cantha though)

nemwar

Well, i started a few days ago... there are a handful german guilds still active...
i think in the rest of the world it is the same...

There are still active Facebook-Groups...
The idea behind my project is to collect all of the wide spread infos and store it online.
So you see... the BBCode would be nice to collect the builds.

I didn't manage to get it to work...  :-\

Themes/default/index.template.php - added bevor </body>
<script type="text/javascript" src="http://gw4ever.bplaced.net/gwbbcode/api.js"></script>
<script type="text/javascript" >
    GWConfig.lang = "en";
    GWOnLoad(Funktion(){
    GWBBCodeParse(".postarea, .post");
    });
</script>

With Google-Dev-Tools i get following Error-Message:

Uncaught SyntaxError: missing ) after argument list

on this line:
    GWOnLoad(Funktion(){

Ah, before i forget... pathes in api.js also changed to point to right places on my webspace/path/file.

You like Guild Wars?
You still play Guild Wars?
Then you may like to visit my website:
Guild Wars Characters Reloaded

Arantor

Think that should be written as function() rather than Funktion() and also take the comma out of the code parse, your original code looked at two different places, my suggestion looks at one more specifically (post bodies).

nemwar

@Arantor

It works.... thank you very much.
And if you ever want to go for a ride through Tyria, get in touch... we'll find something together.



Solution for all others:

Get your files from github: https://github.com/arnapou/gwbbcode
Theres also a updated fork: https://github.com/call-cc/gwbbcode

Copy \public\gwbbcode to your webspace (i choose \gwbbcode)

Modify: \Themes\default\index.template.php
before: </body>
<script type="text/javascript" src="http://youradress.bsp/gwbbcode/api.js"></script>
<script type="text/javascript" >
    GWConfig.lang = "en";
    GWOnLoad(function(){
    GWBBCodeParse(".postarea .post");
    });
</script>   


Modify: api.js

find: var GWConfig = {
css: {
theme: 'http://yoursite.bsp/gwbbcode/themes/arnapou/theme.css',
skills: 'http://yousite.bsp/gwbbcode/skills/skills.css'
},
js: {
data: {
en: 'http://yoursite.bsp/gwbbcode/data/en.js'


Change every shown link to your site / right location on your site.




That's it... now it 'should' work... mine did...

You like Guild Wars?
You still play Guild Wars?
Then you may like to visit my website:
Guild Wars Characters Reloaded

Arantor

I haven't been to GW1 in a long time, must see if I cam dig out my login details :)

nemwar

Last add/note:

It also works for 2.0.

I had to "downgrade" because of a other mod.

You like Guild Wars?
You still play Guild Wars?
Then you may like to visit my website:
Guild Wars Characters Reloaded

Advertisement: