Skip to main content
Topic: Stupid Bouncy BBC (plus a range of marquees) (Read 5143 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #15

Improved bouncing parrot:bird:  how is that even possible !

Strange that its throwing an error during uninstall, sounds like a permissions error but the system checks for that during the test phase.

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #16

I figure out some tricks to make it behave a bit better, and add extra flexibility. ;)

And yes, it is weird how it refuses to uninstall the CSS file now. It's not a deal breaker, just an odd glitch.

Anyway, I have some improvements to the improved version on the way, so don't get too excited yet. :D

Note: For some reason I can't see the attachment to my previous post, even though the post has the paper clip icon showing. Might be another 2.0 beta bug.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #17

QuoteNote: For some reason I can't see the attachment to my previous post, even though the post has the paper clip icon showing. Might be another 2.0 beta bug.
Glad its not just me LOL ... I need to do a refresh of the site files this weekend, its all fine on my local, however often quick fixes / tests get applied to the site, as such sometimes templates and controllers get out of sync.  I'll get it fixed soon.

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #18

I just removed that attachment anyway. I've been playing with the tag's code and have a better version sorted. Runs perfectly on SMF 2.0x or 2.1.x, so I just need to swap the innards over to an Elk package. :)

ETA: Hey, general question. At the moment the sources file has this format for the tag code...
Code: [Select]
/* Not sure what this does. If it's for Elk 1.0.x, get rid of it! */
function stupid_bouncy(&$codes)
{
global $modSettings;

// Only for when bbc is on.
if (empty($modSettings['enableBBC']))
return;

// Make sure the admin has not disabled the bouncy tag.
if (!empty($modSettings['disabledBBC']))
{
foreach (explode(',', $modSettings['disabledBBC']) as $tag)
{
if ($tag === 'bouncy')
return;
}
}
// Not sure what this does. If it's for Elk 1.0.x, get rid of it!
// Now to wreak havoc n unsuspecting web denizens!
$codes[] = array(
'tag' => 'bouncy',
'before' => '<div class="parrot_kingdom"><div class="parrot_cage"><div class="parrotz">',
'after' => '</div></div></div>',
'disallow_children' => array('bouncy', 'center', 'code', 'hr', 'left', 'list', 'me', 'quote', 'right', 'spoiler', 'table'),
);
}

But is also has this:
Code: [Select]
/**
 * stupid_bouncy
 *
 * Codes hook for 1.1.x, integrate_additional_bbc, Called from ParseWrapper getCodes()
 *
 * @param mixed[] $codes array of codes as defined for parse_bbc
 */
function stupid_bounces(&$codes)
{
// Add our tag info to the parser, this controls how the tag will render.
// This appears to be the tag syntax for Elk 1.1.x.
// Interrogate damned devs! :P
$codes[] =
array(
\BBC\Codes::ATTR_TAG => 'bouncy',
\BBC\Codes::ATTR_TYPE => \BBC\Codes::TYPE_PARSED_CONTENT,
\BBC\Codes::ATTR_BEFORE => '<div class="parrot_kingdom"><div class="parrot_cage"><div class="parrotz">',
\BBC\Codes::ATTR_AFTER => '</div></div></div>',
\BBC\Codes::ATTR_DISALLOW_CHILDREN => array('bouncy', 'center', 'code', 'hr', 'left', 'list', 'me', 'quote', 'right', 'spoiler', 'table'),
\BBC\Codes::ATTR_BLOCK_LEVEL => false,
\BBC\Codes::ATTR_AUTOLINK => false,
\BBC\Codes::ATTR_LENGTH => 6,
);
}

Can the first load of crud be dropped, if I am only supporting Elk 1.1.x?
 Antechinus likes dropping crud I don't need. Less confusing. :P
Last Edit: April 30, 2022, 05:45:26 pm by Antechinus
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #19

Sorry homeboy, you should use the new format for the parser. 

Just like your vintage 1990 MC Hammer parachute pants and flip phone are dated, so is that vintage of the parser.  The new way (well since 1.1) is faster, cleaner, can make you good looking.  OK that last part is not true, but anyone under the age of 40 will see your code and think, hey this guy is not a old fossil, so there is that.

https://www.youtube.com/watch?v=otCpCn0l4Wo

You better get hype, boy, because you know you can't (You can't parse this)

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #20

I think you may have edited your question while I was replying ... As I recall when I helped package that up it had 1.1 and 1.0 stuff in the package.  Yes you can, and probably should, drop the 1.0 support, no need for it any longer and I don't think it will run on any current version of PHP anyway.

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #21

Quote from: Spuds – Sorry homeboy, you should use the new format for the parser. 

Just like your vintage 1990 MC Hammer parachute pants and flip phone are dated, so is that vintage of the parser.  The new way (well since 1.1) is faster, cleaner, can make you good looking.  OK that last part is not true, but anyone under the age of 40 will see your code and think, hey this guy is not a old fossil, so there is that.

https://www.youtube.com/watch?v=otCpCn0l4Wo

You better get hype, boy, because you know you can't (You can't parse this)

I figgered march madness was over a month ago so the trash-talkin woulda run off by now, but noooooo...

[edit - no, that link was just wrong..]  I'm good with keepin it real
Last Edit: April 30, 2022, 09:23:49 pm by Steeley

// Deep inside every dilemma lies a solution that involves explosives //

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #22

Times have changed LOL

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #23

yea ...(but keep my flip phone out of it..}  :-[

// Deep inside every dilemma lies a solution that involves explosives //

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #24

I'll take a look at this. I finally have the SMF version to the stage where people are not asking for more features. :D

Apart from bouncing parrots it now also does vertical and horizontal marquees, and a few other tricks. Transferring the code over to Elk should be pretty straightforward.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #25

Ok, what's up with this? It installs and uninstalls cleanly (no errors) but won't make an existing tag bounce (just renders the raw db content).

ETA: Yep, all the files are being extracted to where they should be. I checked that.

ETA2: Hang on, the CSS file is being called in head, as it should be, but the javascript file is not.
Obvious question here: does hook="pre_javascript_output" still exist in Elk 1.1.x?
(And no, this would not stop the tag bouncing - that's all CSS.)

Code: [Select]
//	Codes hook for 1.1.x - integrate_additional_bbc
// Called from ParseWrapper getCodes()
function stupid_bounces(&$codes)
{
$codes[] =
array(
\BBC\Codes::ATTR_TAG => 'bouncy',
\BBC\Codes::ATTR_TYPE => \BBC\Codes::TYPE_PARSED_CONTENT,
\BBC\Codes::ATTR_PARAM => array(
'bounce' => array(
\BBC\Codes::PARAM_ATTR_VALUE => '$1',
\BBC\Codes::PARAM_ATTR_MATCH => '([a-z\-]{1,9}|[a-z\-]{1,9}\_[a-z\-]{1,9}|[a-z\-]{1,9}\_[a-z\-]{1,9}\_[a-z\-]{1,9})',
\BBC\Codes::PARAM_ATTR_OPTIONAL => true,
),
'height' => array(
\BBC\Codes::PARAM_ATTR_VALUE => 'height:$1px;',
\BBC\Codes::PARAM_ATTR_MATCH => '(\d+)',
\BBC\Codes::PARAM_ATTR_OPTIONAL => true,
),
'hover' => array(
\BBC\Codes::PARAM_ATTR_VALUE => '$1',
\BBC\Codes::PARAM_ATTR_MATCH => '([a-z\-]{1,9})',
\BBC\Codes::PARAM_ATTR_OPTIONAL => true,
),
'padding' => array(
\BBC\Codes::PARAM_ATTR_VALUE => ' style="padding:$1px calc($1px / 2)"',
\BBC\Codes::PARAM_ATTR_MATCH => '(\d+)',
\BBC\Codes::PARAM_ATTR_OPTIONAL => true,
),
'time' => array(
\BBC\Codes::PARAM_ATTR_VALUE => 'animation-duration:$1s',
\BBC\Codes::PARAM_ATTR_MATCH => '(\d+)',
\BBC\Codes::PARAM_ATTR_OPTIONAL => true,
),
'toggle' => array(
\BBC\Codes::PARAM_ATTR_VALUE => ' parrot_show',
\BBC\Codes::PARAM_ATTR_MATCH => '(true)',
\BBC\Codes::PARAM_ATTR_OPTIONAL => true,
),

),
\BBC\Codes::ATTR_BEFORE => '<div class="parrot_kingdom{bounce}{hover}"{padding}><span class="parrot_toggle{toggle}"></span><div class="parrot_cage" style="{height}{time}"><div class="parrot" style="{time}">',
\BBC\Codes::ATTR_AFTER => '</div></div></div>',
\BBC\Codes::ATTR_DISALLOW_CHILDREN => array('bouncy', 'center', 'code', 'hr', 'left', 'list', 'me', 'quote', 'right', 'spoiler', 'table'),
\BBC\Codes::ATTR_BLOCK_LEVEL => false,
\BBC\Codes::ATTR_AUTOLINK => true,
\BBC\Codes::ATTR_LENGTH => 6,
);
}

ETA: Deleted test version of zip.
Last Edit: May 07, 2022, 12:15:53 am by Antechinus
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #26

pre_javascript_output does indeed exist ... I'll take a look and see whats up

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #27

Only thing I noticed was the "plain" tag was not working, but it requires a "plain" tag definition.  Here is an attempted update.

The JS you added is at the bottom of the sources, it has deferred = true so its loaded at the bottom, which seems to make sense given what it is doing.

eta removed attachment
Last Edit: May 07, 2022, 08:34:43 am by Spuds

Re: I finally did it: CSS3 standards-compliant bouncing parrots BBC!

Reply #28

Ok, ta. But why would it require a separate definition if all the parameters are optional? SMF does it all off the one definition, which is why I thought it would work in Elk. :P

And d'oh at the js file being loaded. I was looking in the wrong place.

Again, SMF 2.1 loads deferred js in head, but of course execution is deferred (due to the defer attribute in the script tag) which is a pretty normal way of doing it these days (because then the js doesn't block other content). So when I saw defer = true in Elk arrays I naturally assumed it would make use of the defer attribute in the script tag.

The way Elk 1.1.x does it is actually a bit old school: loading just before the body tag but with no defer attribute. That's the way it was done before the defer attribute was widely supported.

It's actually better for initial loading (ie: no files cached in the browser) to load js in head, but with the defer attribute in the script tag.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Stupid Bouncy BBC (plus a range of marquees)

Reply #29

Ok, it bounces now with a plain tag, but... it kills smileys... which means no bouncing parrots.
All you get is the actual typed smiley code:
Code: [Select]
:parrot:

So, tried changing the tag type in your plain tag example to:
Code: [Select]
Codes::ATTR_TYPE => Codes::TYPE_PARSED_CONTENT,

Result: smileys are back, but it stops bouncing, because the tag markup is no longer echoed to the browser.

You guys make it difficult to do things for Elk, y'know. :P

So... then I changed the plain tag from this:
Code: [Select]
	// A plain old tag
$codes[] = array(
Codes::ATTR_TAG => 'bouncy',
Codes::ATTR_TYPE => Codes::TYPE_PARSED_CONTENT,
Codes::ATTR_CONTENT => '<div class="parrot_kingdom"><div class="parrot_cage"><div class="parrot">$1</div></div></div>',
Codes::ATTR_DISALLOW_CHILDREN => array('bouncy', 'center', 'code', 'hr', 'left', 'list', 'me', 'quote', 'right', 'spoiler', 'table'),
Codes::ATTR_BLOCK_LEVEL => false,
Codes::ATTR_AUTOLINK => true,
Codes::ATTR_LENGTH => 6,
);

To this:
Code: [Select]
	// A plain old tag
$codes[] = array(
Codes::ATTR_TAG => 'bouncy',
Codes::ATTR_TYPE => Codes::TYPE_PARSED_CONTENT,
Codes::ATTR_BEFORE => '<div class="parrot_kingdom"><span class="parrot_toggle"></span><div class="parrot_cage"><div class="parrot">',
Codes::ATTR_AFTER => '</div></div></div>',
Codes::ATTR_DISALLOW_CHILDREN => array('bouncy', 'center', 'code', 'hr', 'left', 'list', 'me', 'quote', 'right', 'spoiler', 'table'),
Codes::ATTR_BLOCK_LEVEL => false,
Codes::ATTR_AUTOLINK => true,
Codes::ATTR_LENGTH => 6,
);

Result: everything works now. It bounces, and it has parrots. :D

See the OP of this thread for the latest version, and instructions on how it all works. :)
Last Edit: May 07, 2022, 12:50:49 am by Antechinus
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P