MyBB Community Forums

Full Version: CSS Buttons and other things
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
It will probably be more than several weeks when you consider testing and compatibility.

Adding jQuery support is probably the biggest disruptive change outside of the new theme (or I guess you can consider them part of the same upgrade). But when you look at the development of both libraries against how long we want MyBB 1.8 to 'survive', jQuery is the only option.

Plus, more and more theme artists would prefer jQuery over Prototype. We also need to consider the impact this has on the general user. And we're wanting to attract more developers, artists and users to MyBB - even though no one has complained that IP.Board uses the Prototype/Scriptaculous combination - I feel it won't be long before they too will be making the switch.
Good, good!

One amateurish question:
How does jQuery improve a Multiquote on/off state system based on CSS buttons? what are the limitations of Prototype? If it's too complex to explain, don't worry.
There are no limitations that I know of for using it with MyBB. I use CSS buttons on my forum and multi quote works fine. I think I made four tiny edits to my JavaScript files to do it.

I do protect Prototype where I can. Everything I have seen with MyBB themes, give or take a few exceptions, are more than possible with Prototype. Why they decide to just whap jQuery in there completely irks me rotten. Unfortunately the development is terrible - 1.7.1 was available on GitHub about 2 weeks ago and it still isn't on their website. That is almost 18 months without a single public release. We simply had to move to jQuery in 1.8.
Tomm, mind sharing the JS changes you made? Would like to make my mq button pure CSS too
(2012-06-21, 05:05 PM)Tomm M Wrote: [ -> ]There are no limitations that I know of for using it with MyBB. I use CSS buttons on my forum and multi quote works fine. I think I made four tiny edits to my JavaScript files to do it.

I did notice you were using css buttons on Xekko Tomm, but when I was snooping in your js (Blush) I thought you were still using an image on the MQ - a png yea, but still an image.

(2012-06-21, 05:05 PM)Tomm M Wrote: [ -> ]Everything I have seen with MyBB themes, give or take a few exceptions, are more than possible with Prototype.

I try to use Prototype based solutions where ever possible - but cookies in Prototype are a mystery to me. I want to be able to make a selection and keep it that way on page refresh. That is the only place where I use jQuery in the public areas of my board - where I want cookies/persistence
Your luck is in today Lee; check out ./jscripts/general.js - inside this file is a Cookie function you can use to get, set and remove cookies. The functionality is already built into MyBB.

(2012-06-21, 07:07 PM)brad-t Wrote: [ -> ]Tomm, mind sharing the JS changes you made? Would like to make my mq button pure CSS too

Certainly; I do use a PNG icon but I switch classes instead of icons in the JS.

Open ./jscripts/thread.js. Find the following:

Line 19: element.src = element.src.replace("postbit_multiquote.gif", "postbit_multiquote_on.gif");
Line 52: element.src = element.src.replace("postbit_multiquote.gif", "postbit_multiquote_on.gif");
Line 57: element.src = element.src.replace("postbit_multiquote_on.gif", "postbit_multiquote.gif");
Line 138: element.src = element.src.replace("postbit_multiquote_on.gif", "postbit_multiquote.gif");

Replace with:

Line 19: element.addClassName("multiquote_on");
Line 52: element.addClassName("multiquote_on");
Line 57: element.removeClassName("multiquote_on");
Line 138: element.removeClassName("multiquote_on");

So, basically it will change whatever element has the 'multiquote' id; for example my layout:

<span class="button multiquote" id="multiquote_1">
     <a href="x"><span>Quote</span></a>
</span>

This then becomes the following when activated:

<span class="button multiquote multiquote_on" id="multiquote_1">
     <a href="x"><span>Quote</span></a>
</span>

The multiquote_on class overwrites the background image in my multiquote class.

Viola.
Thanks. I was able to learn a bit from this! Will be able to do what I want now ...
I think it would be cool Tomm M put it also in http://community.mybb.com/forum-38.html

would greatly facilitate future reference and would also be of public utility

Thanks
Nope, because 1.8 should have this functionality built in.
(2012-06-21, 11:04 PM)Tomm M Wrote: [ -> ]Nope, because 1.8 should have this functionality built in.

ok... Big Grin
Pages: 1 2 3 4 5