SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
INFORMATION ORGANIZATION LAB                                                                     SEPTEMBER 8, 2009




                LAST WEEK ON IO LAB
            If you haven’t done these things already, please do them before we begin today’s lecture



                                   Install Firebug and Greasemonkey.


                                   Complete the online skills assessment.


                                   Join the iolab@ischool mailing list.


                       You can find links to help with all of these on the course website at
                                 http://courses.ischool.berkeley.edu/i290-4/f09/
INFORMATION ORGANIZATION LAB                                                           SEPTEMBER 8, 2009




             INFORMATION ORGANIZATION LAB
                                Faculty: Bob Glushko
                 Student Instructors: Nick Doty & Ryan Greenberg

A warning: Today is going to be a full-on crash course in the web client technologies we'll be
using for much of this class (HTML/CSS and Javascript/JQuery) followed by actually building
on that with web browser extensions like Greasemonkey. This should begin to explain the
basics behind the tutorial you worked on this past week and the demo that Ryan did last
week, but it may still be a lot to take in and we'll be talking a lot today. We promise that you'll
have time to learn this stuff beyond just today and that we won't be talking as much every
class.
INFORMATION ORGANIZATION LAB                                      SEPTEMBER 8, 2009




                               OFFICE HOURS
                                   Room 210


                   Nick                             Ryan
            Friday                            Wednesday
          1:00-2:00                           1:00–2:00

                            And by appointment.
              Email ryan@ischool or npdoty@ischool to schedule.
INFORMATION ORGANIZATION LAB                                                           SEPTEMBER 8, 2009




                           WHAT WE KNOW




                       HTML                   CSS                         Javascript


Based on the results of the unscientific survey you completed last week.
INFORMATION ORGANIZATION LAB                                                                SEPTEMBER 8, 2009




   DOCUMENT OBJECT MODEL
    <html>                                                             body
    <body>
    <div id="header">
        <h1>Document Object Model</h1>
    </div>                                                 div                       div
                                                          header                    content
    <div id="content">
        <p>This is my first paragraph</p>
        <p>My second paragraph has a list:
             <ul>                                           h1                p       p           p
                  <li>Item One</li>
                  <li>Item Two</li>
                  <li>Item Three</li>
             </ul>
                                                                                      ul
        </p>
        <p>This is the third paragraph</p>
    </div>
    </body>
    </html>                                                                    li      li         li




Here on the right side is a short HTML document. When your web browser loads this
document, it generates a representation called the Document Object Model.
If your code is properly indented, your can see that the hierarchy of the DOM corresponds to
the indentation level.

The big idea here is that the left is just a bunch of text. On the right there is a collection of
objects that you can manipulate and change.

See http://en.wikipedia.org/wiki/Document_Object_Model for more information.
INFORMATION ORGANIZATION LAB                                                    SEPTEMBER 8, 2009




       CASCADING STYLE SHEETS
Separate presentation from structure and content.
If you want to be impressed by what’s possible with CSS, see http://csszengarden.com.
INFORMATION ORGANIZATION LAB                                                                   SEPTEMBER 8, 2009




                          RULE STRUCTURE




                                                                     From CSS: The Definitive Guide




A stylesheet consists of a series of rules. Here you see the structure of a style rule. You start
with a selector, which specifies what elements in the DOM you want this rule to apply to.
Then you write one or more declarations to apply styles to that selection. Declarations are
separated by semi-colons.
INFORMATION ORGANIZATION LAB                                                          SEPTEMBER 8, 2009




                               SELECTORS
                                             CSS                         HTML

               Type (Tag)                      p                          <p>

                       Id                 #header                    id="header"

                    Class                  .author                 class="author"

              Descendent                     div p                   <div><p>

                Grouping                    h1, h2               <h1> and <h2>

Who can explain the difference between IDs and classes? IDs are unique, only occur once on
the page. Classes are recurring elements.
Both can add semantic meaning to the page.
For a complete list of selectors in CSS2, see http://www.w3.org/TR/CSS2/selector.html.
For a list of all the selectors that jQuery can use (which are a lot more than CSS2), see http://
docs.jquery.com/Selectors.
INFORMATION ORGANIZATION LAB                                                                        SEPTEMBER 8, 2009




               COMMON PROPERTIES
         font-family                  color                  border                  display



             margin                font-size                  width                  padding



        background                  position               text-align                  float


              See http://htmldog.com/reference/cssproperties/ for a good list of CSS2 properties.
Let’s do some examples.
(1) I want to make the blog
(2) Align the text in the header: #header { text-align: center; }
(3) Make every author’s name’s much bigger. .author
(4) I want to make the titles of the blog entries blue Papyrus.
INFORMATION ORGANIZATION LAB                                                     SEPTEMBER 8, 2009




                           THE BOX MODEL
                                        Margin
                                        Border
                                        Padding

                                          Width
                               Height




Every object on the page consists of a rectangular box. The content area, plus padding,
border, margin. When you set the width of an element using CSS, that is the width of the
content area, not the entire box. If you set {width: 500px; padding: 20px; border: 1px solid
black}, the box will be 542px wide: 500, plus 20 padding on each side, plus 1 border on each
side.
INFORMATION ORGANIZATION LAB                                                                 SEPTEMBER 8, 2009




                               CSS RESOURCES




                     Available free for students at http://proquest.safaribooksonline.com.

CSS Definitive Guide: http://proquest.safaribooksonline.com/0596527330
CSS Missing Manual:

Heads-First XHTML & CSS: http://proquest.safaribooksonline.com/059610197X/hfhtmlcss-
CHP-8?imagepage=285
“Expanding your vocabulary” http://proquest.safaribooksonline.com/059610197X/
hfhtmlcss-CHP-8?imagepage=285
INFORMATION ORGANIZATION LAB                                                       SEPTEMBER 8, 2009




      JAVASCRIPT CRASH COURSE
Everyone open up a copy of Firefox and Firebug. If you would like, you can also use Safari’s
web inspector. Some things in Safari are much better, but I’ll be using Firebug. Cross-
platform, has a few more developed features.
INFORMATION ORGANIZATION LAB                                                    SEPTEMBER 8, 2009




                       FIRST THINGS FIRST

       JavaScript is a high-level, object-oriented language used most
                            often in web browsers.

              You can write comments in your code with // or /* */

                 A semi-colon goes at the end of every statement.




It’s a dynamic, scripting language. Prototype-based inheritance, not class-based. See
Douglas Crockford’s explanation for more information: http://javascript.crockford.com/
prototypal.html
INFORMATION ORGANIZATION LAB                                                        SEPTEMBER 8, 2009




                               VARIABLES
               29                        'Bob'                              true
          Numbers                          Strings                         Boolean


              ['Bob', 'John', 'Coye', 'Deirdre']
                                           Arrays


            {'name': 'Arnold', 'weight': 240}
                                          Objects
Variables can be of different types. We’re going to cover these basic data types.
INFORMATION ORGANIZATION LAB                                                         SEPTEMBER 8, 2009




                               VARIABLES


                 var stateName = 'California';




You use the word ‘var’ to declare a variable. You don’t have to say what type of variable it
is--variables in JavaScript are untyped. Convention is to use camelCase.
INFORMATION ORGANIZATION LAB                                    SEPTEMBER 8, 2009




                                 STRINGS
                         A sequence of characters.
             Use single- or double-quotes to indicate a string.

                                      Examples
                                    var myName = "Larry";
                                       myName → "Larry"
                                      myName.length → 5
                               myName.toUpperCase() → "LARRY"
                                   myName.indexOf('a') → 1
INFORMATION ORGANIZATION LAB                                                 SEPTEMBER 8, 2009




                                   ARRAYS
                        An ordered collection of elements.
                      Use square brackets to indicate an array.

                                       Examples
                             var myArray = ['dog', 'fish', 'cat'];
                                       myArray.length → 3
                                      myArray[0] → ['dog']
              myArray.push('horse') → myArray == ['dog', 'fish', 'cat', 'horse']
                                  myArray.indexOf('fish') → 1
                           myArray.sort() → ['cat', 'dog', 'fish'];
INFORMATION ORGANIZATION LAB                                                           SEPTEMBER 8, 2009




                                   OBJECTS
          A collection of key-value pairs or named properties.
                    Use braces to indicate an object.

                                          Examples
                 var person = {'name': 'Arnold', 'weight': 240, 'height': 6.2 }
                                     person.name → "Arnold"
                                       person.height → 6.2
                                     person.wife = 'Maria';
                                      person.wife → 'Maria'
                                    person['wife'] → 'Maria'




The most confusing thing about objects in JavaScript is that they’re used for so many
different things. First, they fill the role of the data structure: hashes/dictionaries (in Python)/
associative arrays. Second, objects are naturally used for JavaScript’s object-oriented
programming. Third, JavaScript objects are also the basis for JSON.

You can access the properties of an object using the dot notation or bracket notation.
INFORMATION ORGANIZATION LAB                                                     SEPTEMBER 8, 2009




                               FUNCTIONS

                       function add(x, y) {
                           return x + y;
                       }
                       add(2,4) → 6

                       var add = function(x, y) {
                           return x + y;
                       }

JavaScript functions are defined with the keyword function and they return a value. Functions
can have names, as in the top example, or they can be anonymous.
INFORMATION ORGANIZATION LAB                                                         SEPTEMBER 8, 2009




                BROWSER FUNCTIONS
                          alert('…')
                        confirm('…')
                         prompt('…')
                       console.log('…')
console.log is better to use when debugging because alert (1) doesn’t give you any history,
(2) you have to click each button. That said, there are times when alert(‘Testing!’) is simply
more convenient.
INFORMATION ORGANIZATION LAB                                                       SEPTEMBER 8, 2009




             CONTROL STRUCTURES

                         if (3 > 2) {
                             alert('3 is greater than 2');
                         }


                         for (var i=0; i < myArray.length; i++) {
                             myArray[i];
                         }




The for loop in JavaScript is a standard C-style for loop. The first statement (here var i=0)
sets the starting condition. The second statement (i < myArray.length) sets how long the loop
will run--until this condition is false. The third statement (i++) says what will happen at the
end of each loop.
INFORMATION ORGANIZATION LAB                                                        SEPTEMBER 8, 2009




                                   +


                                    JQUERY
                                 CSS meets JavaScript


jQuery is a JavaScript library (intro. 2006) written by John Resig. When learning: great when
you can apply something you know to something else. A lot of JS in browser has to do with
selecting objects from the DOM. And we already have something to do that...CSS!
INFORMATION ORGANIZATION LAB                                                         SEPTEMBER 8, 2009




                         NEW HOTNESS VS.
                         OLD AND BUSTED




                           (But with JavaScript instead of computers)
Javascript has been around for awhile. Tutorials on the internet are old. Used to put your
Javascript inline with your HTML. onclick...onload...document.writeln(). Like CSS, the current
best practice is to separate your Javascript from the HTML. We don’t use onevent anymore.

Also, using JavaScript in browsers has often been onerous. To change all the elements with a
certain class, you used to write document.getElementsByTagName(‘*’) ... and a bunch of
other stuff. But new libraries like jQuery let you do this more efficiently: $(‘.name-of-class’)
INFORMATION ORGANIZATION LAB                                      SEPTEMBER 8, 2009




                                       JQUERY

                               Using jQuery involves two steps:

  • Selects        objects from the DOM using CSS selectors.
  • Do      something with the selected elements.
INFORMATION ORGANIZATION LAB                                                       SEPTEMBER 8, 2009




       MAIN JQUERY OPERATIONS


  • Attributes:                Changing existing elements.
  • Traversing:                Moving from selected elements in the DOM to
     others.
  • Manipulating:                 Inserting or removing elements.
  • Events:           Attaching functions to events in the browser.



The jQuery Documentation (http://docs.jquery.com), which is well organized and written,
uses these names as well. Examples:
- Attributes: $(‘h1’).text() gives you the text from the selected elements. $(‘h1’).text(‘New
Text Here’) sets the text in the selected elements.
- Traversing: Moves from selected elements elsewhere in the DOM.
- Manipulating: $(‘p’).after(‘This text will be added after every paragraph’); $
(‘body’).prepend(‘This will appear at the top of the page’)
- Events: You select the elements you want to attach an event to and provide an anonymous
function: $(‘h2’).click( function() { alert(‘You clicked on an h2’); });
INFORMATION ORGANIZATION LAB                                                         SEPTEMBER 8, 2009




                       WEB BROWSER EXTENSIONS
                    Greasemonkey and Jetpack and bears, oh my!


A general overview: we’ll be looking at a class of tools that extend the functionality of a web
browser, either to change the browser chrome (like the status bar or the menu options) or
modify an existing webpage.
INFORMATION ORGANIZATION LAB                                                    SEPTEMBER 8, 2009




                               EXTEND WHAT?

                        Browser chrome
                        Page content
                        Page style
                        Page behavior
Chrome: an image in the status bar that lets you know when you have new email
Content: removing an advertisement or adding a map
Style: giving Craiglist any kind of style at all
Behavior: make a button
INFORMATION ORGANIZATION LAB                                                      SEPTEMBER 8, 2009




                  Greasemonkey                             Mozilla Jetpack




                Firefox Extensions                        Chrome Extensions

Relative advantages and disadvantages. The left-hand column is fairly mature compared to
the right. The top row is fairly light-weight (for development and installation) than the
bottom row. Firefox Extensions have the best performance but are the hardest to develop.
We’ll use Greasemonkey here -- it’s easy to develop, easy to install, and fairly widespread.
But these others have their advantages -- Jetpack makes it particularly easy to add to the
browser’s chrome and Firefox gives you a lot of power that Greasemonkey doesn’t have -- if
you want to use one, go for it! But Greasemonkey is a good start for us and development is
just like modifying an existing webpage.

Anyone know of others? (Safari Saft, IE Activities....)
INFORMATION ORGANIZATION LAB                                                      SEPTEMBER 8, 2009




      GOOD FOR THE BROWSERS

                               GOOD FOR US


For the browsers:
Let users customize and extend the browser, but keep the core small.

For us:
Let us prototype website and browser features without building either from scratch.
INFORMATION ORGANIZATION LAB                                   SEPTEMBER 8, 2009




                               LET’S TRY IT
                               To the browser / text editor!
INFORMATION ORGANIZATION LAB                                                                  SEPTEMBER 8, 2009




                               FOR NEXT WEEK
                         For practice, make sure you can build the Delicious
                         Trailmaker all by yourself. Add a feature to it.


                         Write your first Greasemonkey script. Come with
                         questions next class.


                         Decide on an idea for Project 1.

                       You can find links to help with all of these on the course website at
                                 http://courses.ischool.berkeley.edu/i290-4/f09/

Contenu connexe

En vedette

En vedette (20)

Introduction To Weconomics
Introduction To WeconomicsIntroduction To Weconomics
Introduction To Weconomics
 
Idaily
IdailyIdaily
Idaily
 
My friend past simple
My friend past simpleMy friend past simple
My friend past simple
 
Griffiths ethnography
Griffiths ethnographyGriffiths ethnography
Griffiths ethnography
 
0perating
0perating 0perating
0perating
 
Teaching presentation rubric
Teaching presentation rubricTeaching presentation rubric
Teaching presentation rubric
 
Narration test
Narration testNarration test
Narration test
 
University of iowa libraries chinese collection new acquisitions ...
University of iowa libraries chinese collection new acquisitions ...University of iowa libraries chinese collection new acquisitions ...
University of iowa libraries chinese collection new acquisitions ...
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
2014 PV Performance Modeling Workshop: SolarAnywhere: WebWeb-Accessible Irrad...
2014 PV Performance Modeling Workshop: SolarAnywhere: WebWeb-Accessible Irrad...2014 PV Performance Modeling Workshop: SolarAnywhere: WebWeb-Accessible Irrad...
2014 PV Performance Modeling Workshop: SolarAnywhere: WebWeb-Accessible Irrad...
 
The Voicemail Script Part 2
The Voicemail Script Part 2The Voicemail Script Part 2
The Voicemail Script Part 2
 
QIA #9 - References
QIA #9 - ReferencesQIA #9 - References
QIA #9 - References
 
Tp ingles
Tp inglesTp ingles
Tp ingles
 
Auxiliary equipment
Auxiliary equipmentAuxiliary equipment
Auxiliary equipment
 
Taxonomy of Teachniques
Taxonomy of TeachniquesTaxonomy of Teachniques
Taxonomy of Teachniques
 
Pc54
Pc54Pc54
Pc54
 
Tu dien tranh tau thuy
Tu dien tranh tau thuyTu dien tranh tau thuy
Tu dien tranh tau thuy
 
Silsilah wayang purwa mawa carita jilid 2 2
Silsilah wayang purwa mawa carita jilid 2 2Silsilah wayang purwa mawa carita jilid 2 2
Silsilah wayang purwa mawa carita jilid 2 2
 
美团业务系统通用Ui方案
美团业务系统通用Ui方案美团业务系统通用Ui方案
美团业务系统通用Ui方案
 
Doc280
Doc280Doc280
Doc280
 

Similaire à lecture2_public

GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1Heather Rock
 
Document Object Model
Document Object ModelDocument Object Model
Document Object ModelMayur Mudgal
 
Instagram filters (8 24)
Instagram filters (8 24)Instagram filters (8 24)
Instagram filters (8 24)Ivy Rueb
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingAshok Modi
 
Instagram filters (8 24)
Instagram filters (8 24)Instagram filters (8 24)
Instagram filters (8 24)Ivy Rueb
 
Web development resources brackets
Web development resources bracketsWeb development resources brackets
Web development resources bracketsLaurence Svekis ✔
 
Drupal Frontend Performance and Scalability
Drupal Frontend Performance and ScalabilityDrupal Frontend Performance and Scalability
Drupal Frontend Performance and ScalabilityAshok Modi
 
Winter%200405%20-%20Advanced%20Javascript
Winter%200405%20-%20Advanced%20JavascriptWinter%200405%20-%20Advanced%20Javascript
Winter%200405%20-%20Advanced%20Javascripttutorialsruby
 
Winter%200405%20-%20Advanced%20Javascript
Winter%200405%20-%20Advanced%20JavascriptWinter%200405%20-%20Advanced%20Javascript
Winter%200405%20-%20Advanced%20Javascripttutorialsruby
 
Chapter15-Presentation.pptx
Chapter15-Presentation.pptxChapter15-Presentation.pptx
Chapter15-Presentation.pptxGFRomano
 
Sass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LASass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LAJake Johnson
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Modelchomas kandar
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Modelchomas kandar
 
Upstate CSCI 450 jQuery
Upstate CSCI 450 jQueryUpstate CSCI 450 jQuery
Upstate CSCI 450 jQueryDanWooster1
 
Lesson 3
Lesson 3Lesson 3
Lesson 3hstryk
 
Web Development Training Report.docx
Web Development Training Report.docxWeb Development Training Report.docx
Web Development Training Report.docxCuriosityKlinic
 

Similaire à lecture2_public (20)

GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Instagram filters (8 24)
Instagram filters (8 24)Instagram filters (8 24)
Instagram filters (8 24)
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
 
Instagram filters (8 24)
Instagram filters (8 24)Instagram filters (8 24)
Instagram filters (8 24)
 
Mongo learning series
Mongo learning series Mongo learning series
Mongo learning series
 
Web technologies part-2
Web technologies part-2Web technologies part-2
Web technologies part-2
 
Web development resources brackets
Web development resources bracketsWeb development resources brackets
Web development resources brackets
 
Drupal Frontend Performance and Scalability
Drupal Frontend Performance and ScalabilityDrupal Frontend Performance and Scalability
Drupal Frontend Performance and Scalability
 
Winter%200405%20-%20Advanced%20Javascript
Winter%200405%20-%20Advanced%20JavascriptWinter%200405%20-%20Advanced%20Javascript
Winter%200405%20-%20Advanced%20Javascript
 
Winter%200405%20-%20Advanced%20Javascript
Winter%200405%20-%20Advanced%20JavascriptWinter%200405%20-%20Advanced%20Javascript
Winter%200405%20-%20Advanced%20Javascript
 
Chapter15-Presentation.pptx
Chapter15-Presentation.pptxChapter15-Presentation.pptx
Chapter15-Presentation.pptx
 
Sass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LASass Essentials at Mobile Camp LA
Sass Essentials at Mobile Camp LA
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Upstate CSCI 450 jQuery
Upstate CSCI 450 jQueryUpstate CSCI 450 jQuery
Upstate CSCI 450 jQuery
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
 
Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
Web Development Training Report.docx
Web Development Training Report.docxWeb Development Training Report.docx
Web Development Training Report.docx
 
Fewd week4 slides
Fewd week4 slidesFewd week4 slides
Fewd week4 slides
 

Plus de tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 

Plus de tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Dernier

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Dernier (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

lecture2_public

  • 1. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 LAST WEEK ON IO LAB If you haven’t done these things already, please do them before we begin today’s lecture Install Firebug and Greasemonkey. Complete the online skills assessment. Join the iolab@ischool mailing list. You can find links to help with all of these on the course website at http://courses.ischool.berkeley.edu/i290-4/f09/
  • 2. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 INFORMATION ORGANIZATION LAB Faculty: Bob Glushko Student Instructors: Nick Doty & Ryan Greenberg A warning: Today is going to be a full-on crash course in the web client technologies we'll be using for much of this class (HTML/CSS and Javascript/JQuery) followed by actually building on that with web browser extensions like Greasemonkey. This should begin to explain the basics behind the tutorial you worked on this past week and the demo that Ryan did last week, but it may still be a lot to take in and we'll be talking a lot today. We promise that you'll have time to learn this stuff beyond just today and that we won't be talking as much every class.
  • 3. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 OFFICE HOURS Room 210 Nick Ryan Friday Wednesday 1:00-2:00 1:00–2:00 And by appointment. Email ryan@ischool or npdoty@ischool to schedule.
  • 4. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 WHAT WE KNOW HTML CSS Javascript Based on the results of the unscientific survey you completed last week.
  • 5. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 DOCUMENT OBJECT MODEL <html> body <body> <div id="header"> <h1>Document Object Model</h1> </div> div div header content <div id="content"> <p>This is my first paragraph</p> <p>My second paragraph has a list: <ul> h1 p p p <li>Item One</li> <li>Item Two</li> <li>Item Three</li> </ul> ul </p> <p>This is the third paragraph</p> </div> </body> </html> li li li Here on the right side is a short HTML document. When your web browser loads this document, it generates a representation called the Document Object Model. If your code is properly indented, your can see that the hierarchy of the DOM corresponds to the indentation level. The big idea here is that the left is just a bunch of text. On the right there is a collection of objects that you can manipulate and change. See http://en.wikipedia.org/wiki/Document_Object_Model for more information.
  • 6. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 CASCADING STYLE SHEETS Separate presentation from structure and content. If you want to be impressed by what’s possible with CSS, see http://csszengarden.com.
  • 7. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 RULE STRUCTURE From CSS: The Definitive Guide A stylesheet consists of a series of rules. Here you see the structure of a style rule. You start with a selector, which specifies what elements in the DOM you want this rule to apply to. Then you write one or more declarations to apply styles to that selection. Declarations are separated by semi-colons.
  • 8. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 SELECTORS CSS HTML Type (Tag) p <p> Id #header id="header" Class .author class="author" Descendent div p <div><p> Grouping h1, h2 <h1> and <h2> Who can explain the difference between IDs and classes? IDs are unique, only occur once on the page. Classes are recurring elements. Both can add semantic meaning to the page. For a complete list of selectors in CSS2, see http://www.w3.org/TR/CSS2/selector.html. For a list of all the selectors that jQuery can use (which are a lot more than CSS2), see http:// docs.jquery.com/Selectors.
  • 9. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 COMMON PROPERTIES font-family color border display margin font-size width padding background position text-align float See http://htmldog.com/reference/cssproperties/ for a good list of CSS2 properties. Let’s do some examples. (1) I want to make the blog (2) Align the text in the header: #header { text-align: center; } (3) Make every author’s name’s much bigger. .author (4) I want to make the titles of the blog entries blue Papyrus.
  • 10. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 THE BOX MODEL Margin Border Padding Width Height Every object on the page consists of a rectangular box. The content area, plus padding, border, margin. When you set the width of an element using CSS, that is the width of the content area, not the entire box. If you set {width: 500px; padding: 20px; border: 1px solid black}, the box will be 542px wide: 500, plus 20 padding on each side, plus 1 border on each side.
  • 11. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 CSS RESOURCES Available free for students at http://proquest.safaribooksonline.com. CSS Definitive Guide: http://proquest.safaribooksonline.com/0596527330 CSS Missing Manual: Heads-First XHTML & CSS: http://proquest.safaribooksonline.com/059610197X/hfhtmlcss- CHP-8?imagepage=285 “Expanding your vocabulary” http://proquest.safaribooksonline.com/059610197X/ hfhtmlcss-CHP-8?imagepage=285
  • 12. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 JAVASCRIPT CRASH COURSE Everyone open up a copy of Firefox and Firebug. If you would like, you can also use Safari’s web inspector. Some things in Safari are much better, but I’ll be using Firebug. Cross- platform, has a few more developed features.
  • 13. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 FIRST THINGS FIRST JavaScript is a high-level, object-oriented language used most often in web browsers. You can write comments in your code with // or /* */ A semi-colon goes at the end of every statement. It’s a dynamic, scripting language. Prototype-based inheritance, not class-based. See Douglas Crockford’s explanation for more information: http://javascript.crockford.com/ prototypal.html
  • 14. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 VARIABLES 29 'Bob' true Numbers Strings Boolean ['Bob', 'John', 'Coye', 'Deirdre'] Arrays {'name': 'Arnold', 'weight': 240} Objects Variables can be of different types. We’re going to cover these basic data types.
  • 15. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 VARIABLES var stateName = 'California'; You use the word ‘var’ to declare a variable. You don’t have to say what type of variable it is--variables in JavaScript are untyped. Convention is to use camelCase.
  • 16. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 STRINGS A sequence of characters. Use single- or double-quotes to indicate a string. Examples var myName = "Larry"; myName → "Larry" myName.length → 5 myName.toUpperCase() → "LARRY" myName.indexOf('a') → 1
  • 17. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 ARRAYS An ordered collection of elements. Use square brackets to indicate an array. Examples var myArray = ['dog', 'fish', 'cat']; myArray.length → 3 myArray[0] → ['dog'] myArray.push('horse') → myArray == ['dog', 'fish', 'cat', 'horse'] myArray.indexOf('fish') → 1 myArray.sort() → ['cat', 'dog', 'fish'];
  • 18. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 OBJECTS A collection of key-value pairs or named properties. Use braces to indicate an object. Examples var person = {'name': 'Arnold', 'weight': 240, 'height': 6.2 } person.name → "Arnold" person.height → 6.2 person.wife = 'Maria'; person.wife → 'Maria' person['wife'] → 'Maria' The most confusing thing about objects in JavaScript is that they’re used for so many different things. First, they fill the role of the data structure: hashes/dictionaries (in Python)/ associative arrays. Second, objects are naturally used for JavaScript’s object-oriented programming. Third, JavaScript objects are also the basis for JSON. You can access the properties of an object using the dot notation or bracket notation.
  • 19. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 FUNCTIONS function add(x, y) { return x + y; } add(2,4) → 6 var add = function(x, y) { return x + y; } JavaScript functions are defined with the keyword function and they return a value. Functions can have names, as in the top example, or they can be anonymous.
  • 20. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 BROWSER FUNCTIONS alert('…') confirm('…') prompt('…') console.log('…') console.log is better to use when debugging because alert (1) doesn’t give you any history, (2) you have to click each button. That said, there are times when alert(‘Testing!’) is simply more convenient.
  • 21. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 CONTROL STRUCTURES if (3 > 2) { alert('3 is greater than 2'); } for (var i=0; i < myArray.length; i++) { myArray[i]; } The for loop in JavaScript is a standard C-style for loop. The first statement (here var i=0) sets the starting condition. The second statement (i < myArray.length) sets how long the loop will run--until this condition is false. The third statement (i++) says what will happen at the end of each loop.
  • 22. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 + JQUERY CSS meets JavaScript jQuery is a JavaScript library (intro. 2006) written by John Resig. When learning: great when you can apply something you know to something else. A lot of JS in browser has to do with selecting objects from the DOM. And we already have something to do that...CSS!
  • 23. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 NEW HOTNESS VS. OLD AND BUSTED (But with JavaScript instead of computers) Javascript has been around for awhile. Tutorials on the internet are old. Used to put your Javascript inline with your HTML. onclick...onload...document.writeln(). Like CSS, the current best practice is to separate your Javascript from the HTML. We don’t use onevent anymore. Also, using JavaScript in browsers has often been onerous. To change all the elements with a certain class, you used to write document.getElementsByTagName(‘*’) ... and a bunch of other stuff. But new libraries like jQuery let you do this more efficiently: $(‘.name-of-class’)
  • 24. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 JQUERY Using jQuery involves two steps: • Selects objects from the DOM using CSS selectors. • Do something with the selected elements.
  • 25. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 MAIN JQUERY OPERATIONS • Attributes: Changing existing elements. • Traversing: Moving from selected elements in the DOM to others. • Manipulating: Inserting or removing elements. • Events: Attaching functions to events in the browser. The jQuery Documentation (http://docs.jquery.com), which is well organized and written, uses these names as well. Examples: - Attributes: $(‘h1’).text() gives you the text from the selected elements. $(‘h1’).text(‘New Text Here’) sets the text in the selected elements. - Traversing: Moves from selected elements elsewhere in the DOM. - Manipulating: $(‘p’).after(‘This text will be added after every paragraph’); $ (‘body’).prepend(‘This will appear at the top of the page’) - Events: You select the elements you want to attach an event to and provide an anonymous function: $(‘h2’).click( function() { alert(‘You clicked on an h2’); });
  • 26. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 WEB BROWSER EXTENSIONS Greasemonkey and Jetpack and bears, oh my! A general overview: we’ll be looking at a class of tools that extend the functionality of a web browser, either to change the browser chrome (like the status bar or the menu options) or modify an existing webpage.
  • 27. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 EXTEND WHAT? Browser chrome Page content Page style Page behavior Chrome: an image in the status bar that lets you know when you have new email Content: removing an advertisement or adding a map Style: giving Craiglist any kind of style at all Behavior: make a button
  • 28. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 Greasemonkey Mozilla Jetpack Firefox Extensions Chrome Extensions Relative advantages and disadvantages. The left-hand column is fairly mature compared to the right. The top row is fairly light-weight (for development and installation) than the bottom row. Firefox Extensions have the best performance but are the hardest to develop. We’ll use Greasemonkey here -- it’s easy to develop, easy to install, and fairly widespread. But these others have their advantages -- Jetpack makes it particularly easy to add to the browser’s chrome and Firefox gives you a lot of power that Greasemonkey doesn’t have -- if you want to use one, go for it! But Greasemonkey is a good start for us and development is just like modifying an existing webpage. Anyone know of others? (Safari Saft, IE Activities....)
  • 29. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 GOOD FOR THE BROWSERS GOOD FOR US For the browsers: Let users customize and extend the browser, but keep the core small. For us: Let us prototype website and browser features without building either from scratch.
  • 30. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 LET’S TRY IT To the browser / text editor!
  • 31. INFORMATION ORGANIZATION LAB SEPTEMBER 8, 2009 FOR NEXT WEEK For practice, make sure you can build the Delicious Trailmaker all by yourself. Add a feature to it. Write your first Greasemonkey script. Come with questions next class. Decide on an idea for Project 1. You can find links to help with all of these on the course website at http://courses.ischool.berkeley.edu/i290-4/f09/