Archive for the ‘Gemachtes’ Category

jQuery and stopPropagation

Monday, January 12th, 2009

Often you might not even notice the following problem: Imagine you got a table row or a list element including several links. By default you defined a function like

$('table tr').click(function(event) {
  target = $(this).find('a:first').attr('href');
  open(target, '_self');
})

In this case the function finds the first defined link in our row and links it to the row itself.
If we click on the link, we get redirected to the defined target. But as the link is lying in our linked row, this click will also be executed and our target is loaded twice. Even though the user won’t notice it, functions like deleting or answering will throw errors.
jQuery got a very nice core function to suppress the second loading.

stopPropagation()

We are using this function to stop the propagation of our click-event like shown:

$('table tr').click(function(event) {
  target = $(this).find('a:first').attr('href');
  open(target, '_self');
})
$('table tr a').click(function(event) {
  event.stopPropagation();
})

It reminds me of a “return false;”. Just look for the bind function here:
jQuery API Browser. There you may find more details on similiar cases, too.

UPDATE for Internet Explorer

As this won’t work in MS’ IE, you have to use the similar

event.cancelBubble = true;

(Source)

If you put both behind each other, IE would still throw some errors. So you should try following if-function if you are using jQuery:

    agent = jQuery.browser;
	if(agent.msie) {
		event.cancelBubble = true;
	} else {
		event.stopPropagation();
	}

Coda zur Webentwicklung und Twilight Theme

Tuesday, November 18th, 2008

Seit kurzem ist Panics Coda auf dem Markt – ein Editor (und mehr), der sich konkret an Webentwickler richtet und durch einen eingebauten SVN- sowie FTP-Client glänzt. Ferner integriert er die Möglichkeit des direkten Zusammenarbeits am gleichen Code über Bonjour. Außerdem verfügt er über ab und an recht sinnvolle Syntaxvervollständigungen. Natürlich beherrscht er auch die Standard Features wie Syntax Highlighting, einen integrierten File-Browser und Projectmanagement, und so weiter.

Wichtig, was nun in der aktuellen Version hinzugefügt wurde, ist meiner Meinung nach das so genannte “Open Quickly” was man als TextMate benutzer unter dem Namen “Go to File” kennt. Mir persönlich hat dies immer sehr geholfen Files auch in großen Projekten zu finden. Seit dem dieses Feature zum Leistungsumfang gehört bin ich nun auch freudiger Coda-Nutzer und habe dem lange nicht wirklich upgedateten TextMate den Rücken gekehrt.

Leider ist die Community um Coda noch nicht so groß wie die TextMate’s und so findet sich wenig Material zum anpassen des grässlichen Coda Themes. Für alle die das selbe Problem haben, wie ich es hatte, habe ich meine Files zum Anpassen des Syntax-Highlightings für PHP, HTML, CSS und JS einmal als Zip angehängt.

Es ist ein beruhigender Twilight-Theme:
Download Coda Theme “pex Twilight”

Syntax Highligting Theme CSSSyntax Highligting Theme PHPSyntax Highligting Theme JavaScriptSyntax Highligting Theme HTML

TalentRun startet heute

Monday, December 17th, 2007

Mein neuestes Projekt in Sachen Frontend Entwicklung für die Firma TalentRun GmbH in Hamburg neigt sich seinem Ende und ist heute als Beta für Freunde und Tester auf talentrun.de online gegangen.

Aktuelle Infos findet Ihr zum Beispiel im Videointerview mit Gruenderszene.de auf Sevenload oder in der letzten Pressemeldung der GEMA

Wer die Plattform testen möchte, kann sich natürlich gern melden und seine Freischaltung beschleunigen.
Anbei noch eine kleine Beschreibung der Grundidee der Karaoke-Plattform..
(more…)

Wordwrap problem of mozillas inline-box

Monday, November 5th, 2007

As Firefox and its friends don’t support the normal “display: inline-block” feature of css, it got its own syntax which is called “display: -moz-inline-box”. In most cases you can use it without seeing a difference to the standard CSS-syntax.
One of the bugs is that your element won’t have an automatic break at the end of the line but behaves somehow like “white-space: nowrap”.
The other bug which I will kill by now appears when your inline-block Element doesn’t have a content.
For example when the background is set with CSS and you don’t want anything else to be displayed. Or if you are using Javascript to fill the element.
Anyway Firefox would ignore the line-height and put your element in the next line.
Perhaps you didn’t see this HTML-Enitie for a while as we all use CSS and UTF-8, but a simple   (a white-space) will work, though.

Tabellen- und Listenabstände per CSS im IE

Thursday, October 25th, 2007

Wer angehalten ist für größere Projekte seine Seiten auch dem Microsoft Internet Explorer schmackhaft zu machen, stößt recht schnell auf die Grenzen der vollkommen veralteten CSS Engine.

Ein grandioser Bug im ist hier eine mehrdimensionale Liste. Heisst, eine Liste (ol/ul), die in einer anderen liegt (oder auch in einer Tabelle).
Hier fügt der IE oberhalb der Liste einen Abstand ein, den man mit normalen Margin oder Padding angaben nicht ändern kann. Wir versuchen es: (more…)

Joomla 1.x.x and UTF-8

Thursday, October 25th, 2007

I just converted two Joomla 1.x.x installations to UTF-8 encoding and I will publish the steps required for a working installation. You should consider disabling access to your website while you’re working on it.

  1. Convert database. That’s only possible if you use mysql 4 or higher, as older versions don’t support unicode yet. Converting the database itself meant for me: Use phpMyAdmin to dump it. The dump was already encoded with UTF-8. If it’s not, convert it.
    Also remove the DEFAULT CHARSET for each table:

     CREATE TABLE `v1_banner` (
    ...
    ) ENGINE=MyISAM  <strong>DEFAULT CHARSET=latin1</strong> AUTO_INCREMENT=x ;

    Or replace it by:

     DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

    Now re-import your dump into your database.

  2. Enable UTF-8 for your database connection. Open your includes/database.php and uncomment the