06.05.2013 Views

Drupal 6 JavaScript and jQuery - Ebook-Cours.com

Drupal 6 JavaScript and jQuery - Ebook-Cours.com

Drupal 6 JavaScript and jQuery - Ebook-Cours.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

[ 115 ]<br />

Chapter 4<br />

Let's start out by looking at our frobnitz.info file, which will point to a new CSS<br />

file <strong>and</strong> a new <strong>JavaScript</strong> file:<br />

; $Id$<br />

name = Frobnitz<br />

description = Table-based multi-column theme with <strong>JavaScript</strong><br />

enhancements.<br />

version = 1.0<br />

core = 6.x<br />

base theme = bluemarine<br />

stylesheets[all][] = frobnitz.css<br />

stylesheets[all][] = simpleeditor.css<br />

scripts[] = printer_tool.js<br />

scripts[] = sticky_rotate.js<br />

scripts[] = behaviors.js<br />

scripts[] = simpleeditor.js<br />

The two new files, highlighted in the previous code, will provide a stylesheet <strong>and</strong> a<br />

<strong>JavaScript</strong> library for our tool.<br />

The stylesheet is very simple. Here it is:<br />

.editor-button {<br />

border: 1px solid gray;<br />

padding: 3px;<br />

width: 1em;<br />

text-align: center;<br />

background-color: #eee;<br />

float: left;<br />

}<br />

.editor-button:hover {<br />

background-color: #ccc;<br />

}<br />

.button-bar {<br />

clear: both;<br />

}<br />

It simply takes the elements that make up the buttons <strong>and</strong> button bar, <strong>and</strong><br />

makes them look <strong>and</strong> behave a little more like form buttons. Now, let's move<br />

on to the <strong>JavaScript</strong>.<br />

Here is the simpleeditor.js script in its entirety. After taking a quick look at the<br />

entire file we will go through it more carefully:<br />

// $Id$<br />

/**<br />

* Simple text editing controls for a textarea.<br />

*/<br />

This material is copyright <strong>and</strong> is licensed for the sole use by Richard Ostheimer on 18th June 2009<br />

2205 hilda ave., , missoula, , 59801

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!