Closed zytzagoo closed 10 years ago
Hej @zytzagoo thanks for this.
I'm looking at it but want to wait for a few more opinions from guys better than me in JS before we merge it. I'm all for improving the options as well, as long as the happy case for typical end user remains an oneliner addition in their page (edit to add: and of course if we maintain backwards compatibility, so that we don't have to start versioning stuff).
Belated merge, thanks @al4n for the code review.
Thanks @zytzagoo for awesome work on this!
Started working on #3 and figured, wth, might as well give it the full treatment :)
The major motivator is that now we can create an instance using
var banner = new Cookiebanner(opts);
and callbanner.run()
,banner.insert()
,banner.close()
,banner.agree()
,banner.agreed()
etc. (method names not set in stone) in the exact moment we'd like to (as opposed to just having a bunch of stuff magically happen without any control over it).The "old" mode of operation is still supported and is functioning just as it did earlier -- see/run
tests.js
The few initial tests I wrote all pass, but I probably missed something somewhere...
This hopefully makes any potential further changes easier to implement (and easier to guard against breakage).
While we're on the subject of further changes, the option names are really ripe for a rewrite IMO (could now be easily done in this branch while maintaining full backwards compatibility -- just needs a small options re-writer).
It'd be awesome to get more eyes on this before moving further.