1. Trang chủ
  2. » Công Nghệ Thông Tin

Programming Firefox pptx

513 880 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 513
Dung lượng 5,37 MB

Nội dung

www.it-ebooks.info Programming Firefox www.it-ebooks.info Other resources from O’Reilly Related titles Ajax Design Patterns Ajax Hacks ™ Creating Applications with Mozilla CSS: The Definitive Guide Greasemonkey Hacks ™ JavaScript: The Definitive Guide Learning JavaScript Practical RDF XML Hacks ™ XML in a Nutshell oreilly.com oreilly.com is more than a complete catalog of O’Reilly books. You’ll also find links to news, events, articles, weblogs, sample chapters, and code examples. oreillynet.com is the essential portal for developers interested in open and emerging technologies, including new platforms, pro- gramming languages, and operating systems. Conferences O’Reilly brings diverse innovators together to nurture the ideas that spark revolutionary industries. We specialize in document- ing the latest tools and systems, translating the innovator’s knowledge into useful skills for those in the trenches. Visit conferences.oreilly.com for our upcoming events. Safari Bookshelf (safari.oreilly.com) is the premier online refer- ence library for programmers and IT professionals. Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions in a matter of seconds. Read the books on your Bookshelf from cover to cover or sim- ply flip to the page you need. Try it today for free. www.it-ebooks.info Programming Firefox Kenneth C. Feldt Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo www.it-ebooks.info Programming Firefox by Kenneth C. Feldt Copyright © 2007 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (safari.oreilly.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com. Editor: Simon St.Laurent Production Editor: Rachel Monaghan Copyeditor: Audrey Doyle Proofreader: Rachel Monaghan Indexer: Reg Aubry Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrators: Robert Romano and Jessamyn Read Printing History: April 2007: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Programming Firefox, the image of a red fox, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. This book uses RepKover ™ , a durable and flexible lay-flat binding. ISBN-10: 0-596-10243-7 ISBN-13: 978-0-596-10243-2 [M] www.it-ebooks.info v Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix 1. Firefox and Friends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Mozilla to Firefox and Thunderbird 1 XML Technologies 3 At the Top of It All: The DOM 6 Mixing Document Types 7 Getting Started 7 2. XUL Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 File Structure 12 XUL Widgets 15 Introducing Input Controls 24 More Complex Containers 28 Managing the Display Space 35 Content Display Panels 38 Miscellaneous Widgets 39 Helper Features 40 Mozilla Style Declarations 42 Summary 44 3. Coding and Testing for the Real World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Defining a Target Application 45 Adding Logic 47 Simple Authentication Script 59 When Things Don’t Work 68 Summary 73 www.it-ebooks.info vi | Table of Contents 4. Configuring for Chrome and a Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Chrome Overview 76 Running as a Local Installation 78 XUL-to-Server Communications 80 Serving XUL Files 100 Summary 107 5. Multiframe XUL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Dividing the Display Area 109 Editing Documents 113 Adding Dialog Windows 138 Summary 152 6. Trees, Templates, and Datasources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Trees 154 Modifying Datasources 188 Summary 220 7. DOM Manipulation and Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 A Design Review 221 Browser Elements 222 Moving Text Between Frames 227 Exporting Note Document Content 231 Adding Interactivity to DOM Elements 239 Summary 263 8. Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 A Sample Graphing Project 265 XHTML Review 266 SVG Overview 267 Data-to-Graphics Transformation 272 HTML Canvas 292 Summary 299 9. Extending the Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 Overlay Files 301 Adding Logic 308 XBL 312 HTTP Request Widget 321 Summary 333 www.it-ebooks.info Table of Contents | vii 10. XForms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 Basic XForms Structure 335 An Example Transfer to the Server 336 XForms Validation Features 341 XForms Events and Actions 359 User Interaction and Dynamic Presentation 363 What to Do When Things Go Wrong 373 Summary 373 11. Installation and Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 Deploying Standalone Applications 375 Deploying Themes and Skins 382 Adding Locales 386 Deploying Extensions 391 Deploying the Extension 395 What to Do When Things Go Wrong 400 Summary 403 12. XUL Widget Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 Browser Package Files 405 Developer Reference 410 Glossary: XUL Widgets: Attributes, Properties, and Methods . . . . . . . . . . . . . . . . . 463 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 www.it-ebooks.info www.it-ebooks.info ix Preface1 A technology is only a tool. No matter how creative its design, innovative its approach, or impressive its perfor- mance, a technology is still defined (according to Webster) as “a manner of accom- plishing a task.” The successful adoption of a technology into the community of those who rely on it to conduct business is a complicated journey—one that starts with the unyielding work of designers who see something that others don’t. But without the efforts of those who believe in its value and are willing to promote (evangelize), to educate, and to adapt the tool to the needs of the community, the technology remains little more than a subject of academic interest. The Mozilla component framework, and its implementation in a form more com- monly known as the Firefox browser, represents one technology that aspires to be a useful tool for the community that relies on the Internet to communicate, learn, and express (we often coldly refer to these people as “users”). The evangelists of the Mozilla framework promote its technology as a premier contri- bution of the open source community, a team of developers whose mission is to develop the best possible software for browsing the Internet (Firefox) and exchang- ing messages (Thunderbird). This community is also strongly committed to demon- strating how applying the most current standards in electronic document rendition and data exchange can make possible new techniques that improve the richness of expression and the ability to move those rich ideas throughout the community. But to evangelize is not enough. I hope this text will play a modest role in helping to educate application developers in how to use Mozilla technology—not for the sake of using a different technical platform, but to demonstrate what is possible when the collective knowledge of the international standards community finds its voice in the marketplace. With such a diverse and creative pool of contributors, new Internet applications are possible that feature improvements in responsiveness, greater flexi- bility of interface design, and more expressive graphics. www.it-ebooks.info [...]... PHP Here’s what this means for the Firefox environment: • As an XML file, the XUL file is subject to use of CSS to modify the appearance of its widgets; one interface file can be given a completely different look (color, graphical look) with stylesheets (Much of the concept of different Firefox “skins” is based on XUL and stylesheets.) • As a rendering engine, the Firefox framework was designed to handle... applications that employ JavaScript to manipulate the user interface Many of the functions behind Firefox s more complicated XUL widgets use JavaScript that accesses elements through DOM methods 6 | Chapter 1: Firefox and Friends www.it-ebooks.info Mixing Document Types One of the most underutilized features of the Firefox framework is the ability to render XML documents of different types—that is, XML documents... http://www.mysql.org, as shown in Figure 1-4 Figure 1-4 MySQL Downloads site 10 | Chapter 1: Firefox and Friends www.it-ebooks.info Getting the Browser With a good development editor in hand, the development process requires use of the Firefox browser The latest version is available from http://www.mozilla.com When downloading the Firefox browser, you should check the Developer Tools option during the installation... of tasks and feature enhancements for a real-world project When added to the balance of the text, each chapter can stand on its own to demonstrate a particular topic: Chapter 1, Firefox and Friends Provides an overview of Firefox technology and its history, and a review of the technologies that are the focus of this book Chapter 2, XUL Basics Gives an introduction to the graphical elements that compose... and Document Object Model (DOM) inspector This chapter is a good foundation for understanding the Firefox development tools and the process used to design and build applications Chapter 4, Configuring for Chrome and a Server Sketches out the first NewsSearch application—understanding the chrome URL and how Firefox applications can communicate with a server using the asynchronous HTTP Request protocol... and painting document regions using the drawing features of the HTML Canvas element Chapter 9, Extending the Interface Explains how to make the most of the Firefox framework by extending the functionality of existing graphics elements as well as the Firefox interface Chapter 10, XForms Discusses implementing the next-generation Forms interface through XForms, a technology designed to increase validation... book into your product’s documentation does require permission We appreciate, but do not require, attribution An attribution usually includes the title, author, publisher, and ISBN For example: Programming Firefox by Kenneth C Feldt Copyright 2007 O’Reilly Media, Inc., 978-0-596-10243-2.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact... especially grateful to my mom, who gave me passion for the written word, and to Betsy, whose interest and pride helped sustain my effort xvi | Preface www.it-ebooks.info Chapter 1 CHAPTER 1 Firefox and Friends 1 The Firefox browser is a collection of C++ libraries designed to be assembled into any number of applications that you can run on machines with any of the major desktop operating systems (Windows,... Firebird, and finally was released as Firefox version 1.0 in November 2004 Today the Mozilla Foundation operates as a nonprofit organization to manage the open source development aspects of the program The foundation owns the forprofit Mozilla Corporation, which focuses on browser support for end users and commercialization programs The Mozilla code base now supports the Firefox browser, the Thunderbird... web content), known as the Gecko rendering engine The Mozilla suite offers tools to allow developers to embed the Gecko engine alone in customized applications Figure 1-1 Firefox browser and Thunderbird email client 2 | Chapter 1: Firefox and Friends www.it-ebooks.info At its inception, much of the “buzz” around the original Mozilla browser concerned the ability to extend the functionality of the Cross-Platform . free. www.it-ebooks.info Programming Firefox Kenneth C. Feldt Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo www.it-ebooks.info Programming Firefox by Kenneth C. Feldt Copyright. www.it-ebooks.info Programming Firefox www.it-ebooks.info Other resources from O’Reilly Related titles Ajax Design Patterns Ajax. Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Programming Firefox, the image of a red fox, and related trade dress are trademarks of O’Reilly Media,

Ngày đăng: 29/03/2014, 07:20

w