Updated Syntaxhighlighter

Update #1: hmmmm, stupid but I write these post sometimes weeks ahead…. and this one caught up on me… The new version of SyntaxHighlighter Evolved has ActionScript support.. 🙂
Update #2: I could remove everything below, but I’m keeping this here, perhaps someone can use it…. and it took some time to write, so I really can’t kill my darlings.

A little change I made to the new updated plugin:
find the plugin-folder “syntaxhighlighter” and add the next line to “syntaxhighlighter.php”
[as highlight=”1,3″]
‘as’ => ‘as3’,
‘as3’ => ‘as3’,
‘actionscript’ => ‘as3’,
‘actionscript3’ => ‘as3’,
[/as]
and find in the plugin-folder “syntaxhighlighter”, the folder “scripts” and change the next line to “shBrushAS3.js”
[as wrapper=”true”]
// SyntaxHighlighter.brushes.AS3.aliases = [‘actionscript3’, ‘as3’]; // old line and the bottom of the .js file
SyntaxHighlighter.brushes.AS3.aliases = [‘actionscript3′,’actionscript’, ‘as3’, ‘as’]; // new line
[/as]

the new syntaxhighlighter only uses “as3” and “actionscript3“, and I just changed all my post to “as

Update #3: and update the css, that made the code not wrap….
I removed “white-space: pre;” form “code” and now it wraps:

code  { font-family: "Courier New", Courier, monospace; font-size: 1.2em; /*white-space: pre;*/ color: Gray; }

Today I updated my SyntaxHighlighter JavaScript package by Alex Gorbatchev and it was not easy…

I have a syntax highlighter installed on my blog to show my ActionScript source code in a nice way.
But the first time I installed it, I choose a WordPress plugin which isn’t add to WordPress Plugin Directoryand doesn’t appear to be update.
And if I remember correctly, it didn’t work as it should and I had to add ActionScript. Read my previous decision here.
So I had to upgrade to SyntaxHighlighter Evolved which of course came with some upgrading issues created by my previous install.

First problem: write ActionScript.
ActionScript is not default included in the Syntaxhighter, and you will be advised to use [ javascript ] tag, which is a good advice since AS is almost javascript. It would make your live easier if you choose this option.
But as in my last installment of syntaxhighlighter I want to use Actionscript highlighting.
So there we go:
To do that you need an Actionscript brush. I found two of them: cptloadtest.com has one but it looks like its more for AS2,
and yourpalmark.com which is also the one I choose, because I used his version also with my previous installment and it’s for AS3.

This is what you need to do: install SyntaxHighlighter and if you choose to use [ javascript ]
your done. I was not done yet, so lets continue… Download the shBrushAS3.zip, extract and place the shBrushAS3.js in the correct folder on the server (in my case .../wp-content/plugins/syntaxhighlighter/syntaxhighlighter/scripts). Now you need to change some code in the WordPress plugin:
You can do this in WordPress itself if you have writing permission set, or you can edit the php file on your desktop…
you need to add the highlighted code

// Register brush scripts
wp_register_script( 'syntaxhighlighter-core', plugins_url('syntaxhighlighter/syntaxhighlighter/scripts/shCore.js'), array(), $this->agshver );
wp_register_script( 'syntaxhighlighter-brush-actionscript3', plugins_url('syntaxhighlighter/syntaxhighlighter/scripts/shBrushAS3.js'), array('syntaxhighlighter-core'), $this->agshver);

and

// Create list of brush aliases and map them to their real brushes
$this->brushes = apply_filters( 'syntaxhighlighter_brushes', array(
	'as'       => 'actionscript3',
	'as2'       => 'actionscript3',
	'as3'       => 'actionscript3',
	'actionscript'       => 'actionscript3',
	'bash'       => 'bash',

and now you are ready to go.

I had to change some other stuff ([ source:as ]...[ /source ] into [ as ]...[ /as ] ) and it seems that my css is not playing nice with syntaxhighlighter. hmmmm this is more work then I thought it would be.

I had to deactivate one plugin: autoescape , it didn’t play nice with SyntaxHightlighter. I didn’t use it anymore, and the combination generated gibberish.

Headers broken again: sIFR update

My Flash rendered headers didn’t work after my host transferred my site to another server.
Well in retrospect it’s easy to blame it on the host (sorry guys), but the fault was/is simpler.

I had this problem before : firefox and sifr dont play nice, and just as last time I blamed the wrong person again: not my host but the new Flash Player version 10 killed my sIFR headers…

That would explain why I see my headers at home but not at my work (I didn’t upgrade to Flash Player 10 at home).

The solution is very simple: visit http://novemberborn.net/sifr/2.0.7 and download the latest version of sifr (2.0.7).

Find your sIFR javascript file and check if it’s 2.0.5 or higher:

If you are upgrading from sIFR 2.0.5 or 2.0.6, you must upgrade the sifr.js JavaScript file.

and overwrite it…

And that’s it.
So do you recognize this situation: update the Flash Player recently/ your sIFR headers work on one computer but not on another/ sIFR works in IE and not in Firefox (or the other way around)/ Flash headers are now html headers …. update your sIFR!

For the people that don’t know sIFR:

sIFR is meant to replace short passages of plain browser text with text rendered in your typeface of choice, regardless of whether or not your users have that font installed on their systems. It accomplishes this by using a combination of JavaScript, CSS, and Flash, which renders the font. It degrades gracefully if Flash is not present. sIFR 3 is open source and licensed under the CC-GNU LGPL.

And I use the WordPress plugin CG-FlashyTitles.

ActionScript syntax highlighting

I wanted an easy way to present my ActionScript code on my blog.

The easiest way is to use the code button in WordPress and CSS.
I’ve used this in combination with the pre tag
But that’s doesn’t show nice code highlighting or line numbers…

Syntax highlighting is a feature of some text editors that displays text “especially source code” in different colors and fonts according to the category of terms.

I found out that there are two (probably more, but these two are the ones I tested) methods:
code highlighting server sided (PHP) or client sided (javascript)

Server sided

The first WordPress highlight plugin is: iG:Syntax Hiliter which is based upon GeSHi.

GeSHi – Generic Syntax Highlighter for PHP. Used to highlight almost any code for the web. Nearly 100 supported languages: PHP, HTML, C and more. Styles can be changed on the fly and CSS classes can be used to reduce the amount of XHTML compliant output.

Because the code highlighting is done on the server it’s really quick.
The install was very easy and it’s very easy to use: [as] place your code here [/as] (this is the code you use for ActionScript, read the manual included in the zip for other languages)

Pro: serversided so the code highlighting is done almost at once, a lot of programming languages that can be highlighted, easy to use in WordPress
Con: extra pressure on the server?, no copy to clipboard, not sure how up-to-date the plugin is (it works very good, but the last post about the plugin is from 2006, although the writer of the plugin replies to recent comments), I’m not very fond of the default CSS (but that can be modified). no button in the WordPress wysiwyg/html editor

Client sided

The second plugin is: syntaxhighlighter written by Erik Range, this plugin is based upon dp.SyntaxHighlighter from Alex Gorbatchev.

The plugin that I installed is removed, but there is a new one:http://wordpress.org/extend/plugins/syntaxhighlighter/. This one is in the WordPress plugin directory, so it’s easy to install. I haven’t tested this one

syntaxhighlighter

SyntaxHighlighter is here to help a developer/coder to post code snippets online with ease and have it look pretty. It’s 100% Java Script based and it doesn’t care what you have on your server.

Because the code highlighting is done client sided, you will see some ‘flickering’, and change of appearances of the code block.
Default the dp.SyntaxHighlighter doesn’t include ActionScript so I had to add that to it (digitalflipbook wrote the javascript file so I only had to add it), change the WordPress plugin (it didn’t have ActionScript either ), update the WordPress Plugin to version 1.5.1 of dp.SyntaxHighlighter and fix the copy to clipboard function….

Pro: no extra pressure on the server, copy to clipboard, it looks nicer, posible to add just one language instead of all,
Con: no default ActionScript, view code in popup, no button in the WordPress wysiwyg/html editor

My choice

Both have there strong points and there weaknesses, but I choose iG:Syntax Hiliter because of it has included ActionScript default, and the processing of the code highlighting is done on the server side.

Update #1: For some reason iG:Syntax Hiliter changes the < code>-tag to a highlighted code block with the programming language code (never heard of that programming language 😉 ) but more strangely: to something unreadable… I always test all the plugins I want to use on a WordPress blog installed on a usb-webserver and the plugin works fine there, probably the plugins I have installed on my ‘live’ blog don’t play nice with each other. I don’t have the time to find out who they are, so I used syntaxhighlighter.
There is no reason you shouldn’t use iG:Syntax Hiliter: it works fine with WordPress 2.5, it just doesn’t on my blog. 🙁

[as]
function test ():void {
trace (‘test’);
}
[/as]

FlashBox 1.4 hits 200

Update: I’ve updated my wp-downloadBtn wordpress plugin so you can see the total download:

Yeah, Yeah, I know: nerd!
But I can’t help it feeling somewhat proud: 200+ people found my WordPress plugin FlashBox interesting enough to download.

So let’s say that not everybody who’s downloaded the zip is also installing it. Let’s say 1 out of 10 … 20 users?

Well that good enough for me: I working on FlashBox 1.5 with some new feature requested by FlashBox users and some wishes I had:

  • Redesign
  • Optional: Choose if you want a add a icon to your link when FlashBox is activate
  • Images “cached” into FlashBox
  • Optional: Use FlashBox without rel="flashbox"
  • Optional: “Powered by FlashBox” in the footer
  • …. (still working on all of this and more…)

FlashBox v1.4 – IE6 blocks content

A new version of FlashBox. The main reason for this update is an IE6-bug (read the whole story here)
But by trying to fix this bug, I also created room for the send-a-friend option.

FlashBox is a on going project so for updated versions of it goto the Flashbox directory.

A two image gallery: an tribute to Gungrave. [1] – [2]

Find more examples on the FlashBox homepage.

Download WordPress Plugin – Download FlashBox v1.4

If you have previous versions of FlashBox installed, it’s a good idea to delete the old “wp-flashbox” directory.

Continue reading

FlashBox v1.3

A new version of FlashBox, with one of my personal favorites in it: autoplay. I hope you like it.

FlashBox is a on going project so for updated versions of it goto the Flashbox directory.

A two image gallery: an tribute to Optimus Prime. [1][2]

Find more examples on the FlashBox homepage.

Download WordPress Plugin – Download FlashBox v1.3

Download wp-FlashBox v1.3 wp-flashbox_v01.3.zip (22,1 kB)

If you have previous versions of FlashBox installed, it’s a good idea to delete the old “wp-flashbox” directory.

Continue reading

FlashBox v1.2: fixed error with comma in title

I came across a big bug in the caption. If you placed a comma in the title (which is used for caption) example: title=”bla, bla, bla” the image and the captions got hussled. I fixed this and added some new features (read more).

You can follow my progress in the Flashbox directory. A gallery example: Badass Robots used in film.

Download WordPress Plugin – Download FlashBox v1.2

If you have FlashBox v1.1 installed, you should delete the directory!

Download wp-FlashBox v1.2 wp-flashbox_v01.2.zip (20,1 kB)

Continue reading

FlashBox v1.1: fixed visibility bug FF2 (Apple)

Update #1: Tested on Opera on Apple and Pc

Update #2: Another bug seems to appear in Firefox 2 for the Mac: goto Flashbox directory, click on rel=”flashbox[test]” (you should see a mecha-robot with sword). If you scroll to the top of the page, FlashBox disappears and when you scroll down, you will see it again…

Update #3: Images of bug in Firefox 2 (Apple) [1] [2] [3]

Update #4: another bug, but for all browsers: if you type title=”bla bla bla, bla bla” (title with a komma) the images used in the won’t show.

I love feedback…. and the feedback on FlashBox was that it didn’t work correctly on Firefox 2 on the Mac.
This was a serious bug… and it took me some time to figure out where it was created.

You can follow my progress in the Flashbox directory. A gallery example: Badass Robots used in film.

Transformers Movie Optimus Prime
terminator
robocop
Robot B9 from Lost In Space
ABC Warrior from Judge Dredd
Cain
ed209
droideka
Roy Batty
cylon-centurian
cylons

So the code is tested on:

  • Firefox 2.0.0.2, Opera 9.10 and Safari 1.3.2 on Apple
  • Firefox 2.0.0.2, Opera 9.10 and IE 7.0 on Pc

Sadly I have no access to a Intel Mac with Flock

(Please let me know if it works / or not in other browsers)

Download WordPress Plugin – Download FlashBox v1.1

Download wp-FlashBox v1.1 wp-flashbox_v01.1.zip (19,2 kB)

I haven’t updated the link in wp-plugin.net, because I don’t want the same mistake (not testing on different browsers) twice

Continue reading

My second WordPress plugin: wp-flashbox

Update #1: There are some problems with the plugin in Firefox 2 for the Mac and Flock: FlashBox is loaded, the images are loaded into it, but FlashBox is not visible.
I am looking into it, sorry Mac users!
There is also a difference between Firefox for the PC and IE for the PC: it works perfectly, but in Firefox FlashBox will be restarted and in IE FlashBox starts where it left of (if it’s started before). These is not a bug this is a feature!

Update #2: A feature I forgot to tell about: you don’t have to change the rel="lightbox" tags, it will also work with FlashBox. If you’re planning to use both, you have to use rel="flashbox"– tag. But if you want to use FlashBox instead of Lightbox, you have te deactivate lightbox!

FlashBox is my attempt to create a simple, unobtrusive script used to overlay images on the current page.

Read more about FlashBox in detail, the different post about FlashBoxor you can follow my progress in the Flashbox directory where my experiments are.

But to sum it up: It had to be smaller then the other (Lightbox, Thickbox and Graybox), but with the animation (like Lightbox).
Or just another alternative for Lightbox / Thickbox / Graybox?

And because I wanted to use it on my own blog, I wrote a plugin too. And I’m not afraid to share it with you.

Download WordPress Plugin – Download FlashBox v1.0

Check the latest Flashbox version: the category FlashBox

Download wp-flashbox wp-flashbox_v01.zip (17,9 kB)

Continue reading