commit eb81782cdbdc68aaebe4fa561b5fbb73ef866611 Author: Mark Otto Date: Wed Apr 27 13:53:51 2011 -0700 Porting over all Blueprint styles to new Baseline repo diff --git a/img/baseline-20px.png b/img/baseline-20px.png new file mode 100644 index 0000000000..6894c4c828 Binary files /dev/null and b/img/baseline-20px.png differ diff --git a/img/blueprint-icon.png b/img/blueprint-icon.png new file mode 100644 index 0000000000..babb40979b Binary files /dev/null and b/img/blueprint-icon.png differ diff --git a/img/grid-20px.png b/img/grid-20px.png new file mode 100644 index 0000000000..00cdfaca33 Binary files /dev/null and b/img/grid-20px.png differ diff --git a/img/grid-940px.png b/img/grid-940px.png new file mode 100644 index 0000000000..99b1dd1374 Binary files /dev/null and b/img/grid-940px.png differ diff --git a/img/tablesorter-indicators.png b/img/tablesorter-indicators.png new file mode 100644 index 0000000000..af3c40522f Binary files /dev/null and b/img/tablesorter-indicators.png differ diff --git a/img/twitter-logo-no-bird.png b/img/twitter-logo-no-bird.png new file mode 100644 index 0000000000..70b6573d7e Binary files /dev/null and b/img/twitter-logo-no-bird.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000000..9aa2355b0d --- /dev/null +++ b/index.html @@ -0,0 +1,1011 @@ + + + + + Baseline + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+
+
+

Twitter Baseline

+

Baseline is Twitter's toolkit for kickstarting CSS for websites, apps, and more. It includes base CSS styles for typography, forms, buttons, tables, grids, navigation, alerts, and more.

+
+
+ Download Zip » + + Visit project page on Github »
+ (Current version: 1.0.0) +
+
+
+
+
+
+ +
+ + + +
+ +
+
+

You can use Twitter Baseline in one of two ways: just drop the compiled CSS into any new project and start cranking, or run LESS on your site and compile on the fly like a boss.

+
+
+

1. Compiled CSS

+

Use this option if you want all the styles of Baseline, but none of the extra power of LESS.

+
<link type="text/css" href="css/Baseline.css" media="all" />
+

2. Run with LESS.js

+

Use this option to make full use of Baseline's LESS variables, mixins, and nesting in CSS.

+
+<link rel="stylesheet/less" type="text/css" href="less/Baseline.less" media="all" />
+<script type="text/javascript" src="js/less-1.0.41.min.js"></script>
+
+
+
+ + +
+ +
+
+

Bootstrap is a super awesome pack of mixins and variables to be used in conjunction with LESS, a CSS preprocessor for faster and easier web development.

+
+
+

What's included

+

Here's a rundown of what's included in Twitter Baseline as part of Bootstrap. Head over to the Bootstrap website or Github project page to download and learn more.

+

Color variables

+

Variables in LESS are perfect for maintaining and updating your CSS. When you want to change a color value, update it in one spot and you're set.

+
+// Links
+@link-color:        #0069d6;
+@link-hover-color:  darken(@link-color, 10);
+
+// Grays
+@white:             #fff;
+@gray-lighter:      #ccc;
+@gray-light:        #777;
+@gray:              #555;
+@gray-dark:         #333;
+@black:             #000;
+
+// Accent Colors
+@blue:              #08b5fb;
+@blue-dark:         #0069d6;
+@green:             #46a546;
+@red:               #9d261d;
+@yellow:            #ffc40d;
+@orange:            #f89406;
+@pink:              #c3325f;
+@purple:            #7a43b6;
+
+ +

Two Comment Styles

+
+// This is a comment
+/* No, this is a comment */
+
+ +

Mixins up the wazoo

+
+// Font Stacks
+.font(@weight: normal, @size: 14px, @lineheight: 20px) {
+  font-size: @size;
+  font-weight: @weight;
+  line-height: @lineheight;
+}
+.sans-serif(@weight: normal, @size: 14px, @lineheight: 20px) {
+  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+  font-size: @size;
+  font-weight: @weight;
+  line-height: @lineheight;
+}
+
+// Drop shadows
+.box-shadow(@shadow: 0 1px 3px rgba(0,0,0,.25)) {
+  -webkit-box-shadow: @shadow;
+  -moz-box-shadow: @shadow;
+  box-shadow: @shadow;
+}
+
+// Gradients
+#gradient {
+  .horizontal(@startColor: #555, @endColor: #333) {
+    background-color: @endColor;
+    background-repeat: no-repeat;
+    background-image: -webkit-gradient(linear, left top, right top, from(@startColor), to(@endColor));
+    background-image: -webkit-linear-gradient(right center, @startColor, @endColor);
+    background-image: -moz-linear-gradient(right center, @startColor, @endColor);
+    background-image: -o-linear-gradient(left,  @startColor,  @endColor);
+    background-image: -khtml-gradient(linear, left top, right top, from(@startColor), to(@endColor));
+    filter: e(%("progid:DXImageTransform.Microsoft.Gradient(StartColorStr='%d', EndColorStr='%d', GradientType=1)",@startColor,@endColor));
+    -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorStr='%d', EndColorStr='%d', GradientType=1))",@startColor,@endColor);
+  }
+  .vertical(@startColor: #555, @endColor: #333) {
+    background-color: @endColor;
+    background-repeat: no-repeat;
+    background-image: -webkit-gradient(linear, left top, left bottom, from(@startColor), to(@endColor));
+    background-image: -webkit-linear-gradient(@startColor, @endColor);
+    background-image: -moz-linear-gradient(@startColor, @endColor);
+    background-image: -o-linear-gradient(top,  @startColor,  @endColor);
+    background-image: -khtml-gradient(linear, left top, left bottom, from(@startColor), to(@endColor));
+    filter: e(%("progid:DXImageTransform.Microsoft.Gradient(StartColorStr='%d', EndColorStr='%d', GradientType=0)",@startColor,@endColor));
+    -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorStr='%d', EndColorStr='%d', GradientType=0))",@startColor,@endColor);
+  }
+}
+
+ +

Operations and grid system

+
+@grid_columns: 16;
+@grid_column_width: 40px;
+@grid_gutter_width: 20px;
+.columns(@column_span: 1) {
+  display: inline;
+  float: left;
+  width: (@grid_column_width * @column_span) + (@grid_gutter_width * (@column_span - 1));
+  margin-left: @grid_gutter_width;
+  &:first-child {
+    margin-left: 0;
+  }
+}
+
+
+
+ +
+ + + +
+ +
+
+

Default Grid

+

The default grid system provided as part of Baseline is a 940px wide 16-column grid. It's a flavor of the popular 960 grid system, but without the additional margin/padding on the left and right sides.

+
+
+

Example grid markup

+

As shown here, a basic layout can be created with two "columns," each spanning a number of the 16 foundational columns we defined as part of our grid system. See the examples below for more variations.

+
+<div class="row">
+<div class="span6 columns">
+...
+</div>
+<div class="span10 columns">
+...
+</div>
+</div>
+
+
+
+ +
+
1
+
1
+
1
+
1
+ +
1
+
1
+
1
+
1
+ +
1
+
1
+
1
+
1
+ +
1
+
1
+
1
+
1
+
+ +
+
2
+
2
+
2
+
2
+
2
+
2
+
2
+
2
+
+ +
+
3
+
3
+
3
+
3
+
3
+
1
+
+ +
+
4
+
4
+
4
+
4
+
+ +
+
4
+
6
+
6
+
+ +
+
8
+
8
+
+ +
+
5
+
11
+
+ +
+
16
+
+
+ + + + +
+ +

Headings and paragraphs

+

A standard typographic hierarchy for structuring your webpages.

+
+
+

h1. Heading 1

+

h2. Heading 2

+

h3. Heading 3

+

h4. Heading 4

+
h5. Heading 5
+
h6. Heading 6
+
+
+

Example paragraph (body text)

+

Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula ut id elit.

+
+
+

Emphasis, addresses, & abbreviations

+

+ <strong> + <em> + <address> + <abbr> +

+

When to use

+

Emphasis tags (<strong> and <em>) should be used to add visual distinction between a word or phrase and its surrounding copy. Use <strong> for plain old attention and <em> for slick attention and titles.

+

Emphasis in a paragraph

+

Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Maecenas faucibus mollis interdum. Nulla vitae elit libero, a pharetra augue.

+

Addresses

+

The address element is used for—you guessed it!—addresses. Here's how it looks:

+
+ Twitter, Inc.
+ 795 Folsom Ave, Suite 600
+ San Francisco, CA 94107
+ P: (123) 456-7890 +
+

Note: Each line in an address must end with a line-break (<br />) to properly structure the content as it is read in real life without any styles applied.

+

Abbreviations

+

For abbreviations and acronyms, use the abbr tag (acronym is deprecated in HTML5). Put the shorthand form within the tag and set a title for the complete name.

+ +

Blockquotes

+

+ <blockquote> + <p> + <cite> +

+

Be sure to wrap your blockquote around paragraph and cite tags. When citing a source, use the cite element. The CSS will automatically preface a name with an em dash (&mdash;).

+
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...

+ Dr. Julius Hibbert +
+ +

Lists

+
+
+

Unordered <ul>

+
    +
  • Jeremy Bixby
  • +
  • Robert Dezure
  • +
  • Josh Washington
  • +
  • Anton Capresi
  • +
  • My Team Mates +
      +
    • George Castanza
    • +
    • Jerry Seinfeld
    • +
    • Cosmo Kramer
    • +
    • Elaine Bennis
    • +
    • Newman
    • +
    +
  • +
  • John Jacob
  • +
  • Paul Pierce
  • +
  • Kevin Garnett
  • +
+
+
+

Unstyled <ul.unstyled>

+
    +
  • Jeremy Bixby
  • +
  • Robert Dezure
  • +
  • Josh Washington
  • +
  • Anton Capresi
  • +
  • My Team Mates +
      +
    • George Castanza
    • +
    • Jerry Seinfeld
    • +
    • Cosmo Kramer
    • +
    • Elaine Bennis
    • +
    • Newman
    • +
    +
  • +
  • John Jacob
  • +
  • Paul Pierce
  • +
  • Kevin Garnett
  • +
+
+
+

Ordered lists <ol>

+
    +
  1. Jeremy Bixby
  2. +
  3. Robert Dezure
  4. +
  5. Josh Washington
  6. +
  7. Anton Capresi
  8. +
  9. My Team Mates +
      +
    1. George Castanza
    2. +
    3. Jerry Seinfeld
    4. +
    5. Cosmo Kramer
    6. +
    7. Elaine Bennis
    8. +
    9. Newman
    10. +
    +
  10. +
  11. John Jacob
  12. +
  13. Paul Pierce
  14. +
  15. Kevin Garnett
  16. +
+
+
+

Description lists dl

+
+
Description lists
+
A description list is perfect for defining terms.
+
Your mom
+
Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
+
Donec id elit non mi porta gravida at eget metus.
+
And your dad
+
Etiam porta sem malesuada magna mollis euismod.
+
+
+
+
+ + + +
+ + +
+
+

Building tables

+

+ <table> + <thead> + <tbody> + <tr> + <th> + <td> + <colspan> + <caption> +

+

Tables are great—for a lot of things. Great tables, however, need a bit of markup love to be useful, scalable, and readable (at the code level). Here are a few tips to help.

+

Always wrap your column headers in a thead such that hierarchy is thead > tr > th.

+

Similar to the column headers, all your table's body content should be wrapped in a tbody so your hierarchy is tbody > tr > td.

+ +
+
+

Example: Default table styles

+

All tables will be automatically styled with only the essential borders to ensure readability and maintain structure. No need to add extra classes or attributes.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameLanguage
1YourMomEnglish
2JoeSixpackEnglish
3StuDentCode
+
+<table class="common-table">
+  ...
+</table>
+ +

Example: Zebra-striped

+

Get a little fancy with your tables by adding zebra-striping—just add the .zebra-striped class.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameLanguage
1YourMomEnglish
2JoeSixpackEnglish
3StuDentCode
+
+<table class="common-table zebra-striped">
+...
+</table>
+ +

Example: Zebra-striped w/ TableSorter.js

+

Taking the previous example, we improve the usefulness of our tables by providing sorting functionality via jQuery and the Tablesorter plugin. Click any column's header to change the sort.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameLanguage
1YourMomEnglish
2JoeSixpackEnglish
3StuDentCode
+
+<script type="text/javascript" src="js/jquery/jquery.tablesorter.min.js"></script>
+<script type="text/javascript">
+  $(document).ready(function() {
+    $("table#sortTableExample").tablesorter( {sortList: [[1,0]]} );
+  });
+</script>
+<table class="common-table zebra-striped">
+  ...
+</table>
+
+
+
+ + + +
+ + + +

All forms are given default styles to present them in a readable and scalable way.

+
+
+ Example form legend +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ Some Value Here +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ Example form legend +
+ +
+
+ @ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+ +
+
+
+
+ Example form legend +
+ +
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+ + Note: Labels surround all the options for much larger click areas and a more usable form. + +
+
+
+ +
+
+ + + to + + + All times are shown as Pacific Standard Time (GMT -08:00). +
+
+
+
+ +
+ + + Block of help text to describe the field above if need be. + +
+
+
+ +
+
    +
  • + +
  • +
  • + +
  • +
+
+
+
+ + +
+
+
+ +
+
+

Buttons

+

As a convention, buttons are used for actions while links are used for objects. For instance, "Download" could be a button and "recent activity" could be a link.

+

All buttons default to a light gray style, but a blue .primary class is available. Plus, rolling your own styles is easy peasy.

+
+
+

Example buttons

+

Button styles can be applied to anything with the .btn applied. Typically you'll want to apply these to only a, button, and select input elements. Here's how it looks:

+
+ + +
+

Alternate sizes

+

Fancy larger or smaller buttons? Have at it!

+ + +
+
+
+ + + +
+ + +
+
+

Tabs or pills?

+

Create simple secondary navigation with a ul. Swap between tabs or pills by adding the appropriate class.

+

Great for sub-sections of content like our account settings pages and user timelines for toggling between pages of like content. Available in tabbed or pill styles.

+
+
+ +
+<ul class="tabs">
+  <li class="active"><a href="">Home</a></li>
+  <li><a href="">Profile</a></li>
+  <li><a href="">Messages</a></li>
+  <li><a href="">Settings</a></li>
+  <li><a href="">Contact</a></li>
+</ul>
+
+ +
+<ul class="pills">
+  <li class="active"><a href="">Home</a></li>
+  <li><a href="">Profile</a></li>
+  <li><a href="">Messages</a></li>
+  <li><a href="">Settings</a></li>
+  <li><a href="">Contact</a></li>
+</ul>
+
+
+
+ +
+
+

Pagination

+

Ultra simplistic and minimally styled pagination inspired by Rdio. The large block is hard to miss, easily scalable, and provides large click areas.

+
+
+ + + +
+<div class="pagination">
+  <ul>
+    <li class="prev disabled"><a href="">&larr; Previous</a></li>
+    <li class="active"><a href="">1</a></li>
+    <li><a href="">2</a></li>
+    <li><a href="">3</a></li>
+    <li><a href="">4</a></li>
+    <li><a href="">5</a></li>
+    <li class="next"><a href="">Next &rarr;</a></li>
+  </ul>
+</div>
+
+
+
+ +
+ + + +
+ +
+
+

Basic alerts

+

One-line messages for highlighting the failure, possible failure, or success of an action. Particularly useful for forms.

+
+
+
+ × +

Oh snap! Change this and that and try again.

+
+
+ × +

Holy gaucamole! Best check yo self, you're not looking too good.

+
+
+ × +

Well done! You successfully read this alert message.

+
+
+ × +

Heads up! This is an alert that needs your attention, but it's not a huge priority just yet.

+
+
+
+
+
+

Block messages

+

For messages that require a bit of explanation, we have paragraph style alerts. These are perfect for bubbling up longer error messages, warning a user of a pending action, or just presenting information for more emphasis on the page.

+
+
+
+ × +

Oh snap! You got an error! Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.

+

Take This Action Or Do This

+
+
+ × +

Holy gaucamole! This is a warning! Best check yo self, you're not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

+

Take This Action Or Do This

+
+
+ × +

Well done! You successfully read this alert message. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas faucibus mollis interdum.

+

Take This Action Or Do This

+
+
+ × +

Heads up! This is an alert that needs your attention, but it's not a huge priority just yet.

+

Take This Action Or Do This

+
+
+
+
+ + + +
+

+
+
+ + + \ No newline at end of file diff --git a/js/global.js b/js/global.js new file mode 100644 index 0000000000..a934a3360e --- /dev/null +++ b/js/global.js @@ -0,0 +1,75 @@ +$(document).ready(function(){ + // Get Heights + windowHeight = $(window).height(); + documentHeight = $(document).height(); + sidebarHeight = windowHeight - 40; + containerHeight = windowHeight - 40; + + // Get Widths + windowWidth = $(window).width(); + containerWidth = windowWidth - 200; + + if (windowHeight < containerHeight) { + + // Set Dimensions for default state (before resize) + $('div#sidebar').css({ + height: sidebarHeight + }); + $('div#container').css({ + width: containerWidth, + height: containerHeight + }); + + } else { + + // During resize, set widths + $(window).resize(function() { + console.log('Window Height: ' + $(window).height() + ', Sidebar Height:' + ($(window).height() - 40)); + + // Get Heights + windowHeight = $(window).height(); + sidebarHeight = windowHeight - 40; + containerHeight = windowHeight - 40; + + // Get Widths + windowWidth = $(window).width(); + containerWidth = windowWidth - 200; + + // Set Dimensions for default state (before resize) + $('div#sidebar').css({ + height: sidebarHeight + }); + $('div#container').css({ + width: containerWidth, + height: containerHeight + }); + }); + // console.log('omgz window is less than container so... fuck.'); + $('div#sidebar').css({ + height: documentHeight - 40 + }); + + } + + + +/* + // Toggle Calendars + $('div#sidebar ul li a').click(function() { + if ($(this).is('#toggleMonthView')) { + console.log('toggle month'); + $(this).addClass('active'); + $('#toggleListView').removeClass('active'); + $('table#monthView').show(); + $('table#listView').hide(); + } else { + console.log('toggle list'); + $(this).addClass('active'); + $('#toggleMonthView').removeClass('active'); + $('table#listView').show(); + $('table#monthView').hide(); + } + return false; + }); +*/ +}); diff --git a/js/jquery/chili/css.js b/js/jquery/chili/css.js new file mode 100755 index 0000000000..e86e882240 --- /dev/null +++ b/js/jquery/chili/css.js @@ -0,0 +1,85 @@ +/* +=============================================================================== +Chili is the jQuery code highlighter plugin +............................................................................... +LICENSE: http://www.opensource.org/licenses/mit-license.php +WEBSITE: http://noteslog.com/chili/ + + Copyright 2008 / Andrea Ercolino +=============================================================================== +*/ + +{ + _name: 'css' + , _case: true + , _main: { + comment: { + _match: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\// + , _style: "color: olive;" + } + , directive: { + _match: /@\w+/ + , _style: "color: fuchsia;" + } + , url: { + _match: /\b(url\s*\()([^)]+)(\))/ + , _replace: "$1$2$3" + , _style: "color: fuchsia;" + } + , block: { + _match: /\{([\w\W]*?)\}/ + , _replace: function( all, pairs ) { + return '{' + this.x( pairs, '/definition' ) + '}'; + } + } + , 'class': { + _match: /\.\w+/ + , _style: "color: #CC0066;" + } + , id: { + _match: /#\w+/ + , _style: "color: IndianRed;" + } + , pseudo: { + _match: /:\w+/ + , _style: "color: #CC9900;" + } + , element: { + _match: /\w+/ + , _style: "color: Purple;" + } + } + , definition: { + comment: { + _match: /\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\// + } + , property: { + _match: /\b(?:zoom|z-index|writing-mode|word-wrap|word-spacing|word-break|width|widows|white-space|volume|voice-family|visibility|vertical-align|unicode-bidi|top|text-underline-position|text-transform|text-shadow|text-overflow|text-kashida-space|text-justify|text-indent|text-decoration|text-autospace|text-align-last|text-align|table-layout|stress|speech-rate|speak-punctuation|speak-numeral|speak-header|speak|size|scrollbar-track-color|scrollbar-shadow-color|scrollbar-highlight-color|scrollbar-face-color|scrollbar-dark-shadow-color|scrollbar-base-color|scrollbar-arrow-color|scrollbar-3d-light-color|ruby-position|ruby-overhang|ruby-align|right|richness|quotes|position|play-during|pitch-range|pitch|pause-before|pause-after|pause|page-break-inside|page-break-before|page-break-after|page|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-Y|overflow-X|overflow|outline-width|outline-style|outline-color|outline|orphans|min-width|min-height|max-width|max-height|marks|marker-offset|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|line-break|letter-spacing|left|layout-grid-type|layout-grid-mode|layout-grid-line|layout-grid-char-spacing|layout-grid-char|layout-grid|layout-flow|layer-background-image|layer-background-color|include-source|ime-mode|height|font-weight|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-family|font|float|filter|empty-cells|elevation|display|direction|cursor|cue-before|cue-after|cue|counter-reset|counter-increment|content|color|clip|clear|caption-side|bottom|border-width|border-top-width|border-top-style|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-left-width|border-left-style|border-left-color|border-left|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-color|border-bottom|border|behavior|background-repeat|background-position-y|background-position-x|background-position|background-image|background-color|background-attachment|background|azimuth|accelerator)\s*:/ + , _style: "color: #330066;" + } + , special: { + _match: /\b(?:-use-link-source|-set-link-source|-replace|-moz-user-select|-moz-user-modify|-moz-user-input|-moz-user-focus|-moz-outline-width|-moz-outline-style|-moz-outline-color|-moz-outline|-moz-opacity|-moz-border-top-colors|-moz-border-right-colors|-moz-border-radius-topright|-moz-border-radius-topleft|-moz-border-radius-bottomright|-moz-border-radius-bottomleft|-moz-border-radius|-moz-border-left-colors|-moz-border-bottom-colors|-moz-binding)\s*:/ + , _style: "color: #330066; text-decoration: underline;" + } + , url: { + _match: /\b(url\s*\()([^)]+)(\))/ + , _replace: "$1$2$3" + } + , value: { + _match: /\b(?:xx-small|xx-large|x-soft|x-small|x-slow|x-low|x-loud|x-large|x-high|x-fast|wider|wait|w-resize|visible|url|uppercase|upper-roman|upper-latin|upper-alpha|underline|ultra-expanded|ultra-condensed|tv|tty|transparent|top|thin|thick|text-top|text-bottom|table-row-group|table-row|table-header-group|table-footer-group|table-column-group|table-column|table-cell|table-caption|sw-resize|super|sub|status-bar|static|square|spell-out|speech|solid|soft|smaller|small-caption|small-caps|small|slower|slow|silent|show|separate|semi-expanded|semi-condensed|se-resize|scroll|screen|s-resize|run-in|rtl|rightwards|right-side|right|ridge|rgb|repeat-y|repeat-x|repeat|relative|projection|print|pre|portrait|pointer|overline|outside|outset|open-quote|once|oblique|nw-resize|nowrap|normal|none|no-repeat|no-open-quote|no-close-quote|ne-resize|narrower|n-resize|move|mix|middle|message-box|medium|marker|ltr|lowercase|lower-roman|lower-latin|lower-greek|lower-alpha|lower|low|loud|local|list-item|line-through|lighter|level|leftwards|left-side|left|larger|large|landscape|justify|italic|invert|inside|inset|inline-table|inline|icon|higher|high|hide|hidden|help|hebrew|handheld|groove|format|fixed|faster|fast|far-right|far-left|fantasy|extra-expanded|extra-condensed|expanded|embossed|embed|e-resize|double|dotted|disc|digits|default|decimal-leading-zero|decimal|dashed|cursive|crosshair|cross|crop|counters|counter|continuous|condensed|compact|collapse|code|close-quote|circle|center-right|center-left|center|caption|capitalize|braille|bottom|both|bolder|bold|block|blink|bidi-override|below|behind|baseline|avoid|auto|aural|attr|armenian|always|all|absolute|above)\b/ + , _style: "color: #3366FF;" + } + , string: { + _match: /(?:\'[^\'\\\n]*(?:\\.[^\'\\\n]*)*\')|(?:\"[^\"\\\n]*(?:\\.[^\"\\\n]*)*\")/ + , _style: "color: teal;" + } + , number: { + _match: /(?:\b[+-]?(?:\d*\.?\d+|\d+\.?\d*))(?:%|(?:(?:px|pt|em|)\b))/ + , _style: "color: red;" + } + , color : { + _match: /(?:\#[a-fA-F0-9]{3,6})|\b(?:yellow|white|teal|silver|red|purple|olive|navy|maroon|lime|green|gray|fuchsia|blue|black|aqua|YellowGreen|Yellow|WhiteSmoke|White|Wheat|Violet|Turquoise|Tomato|Thistle|Teal|Tan|SteelBlue|SpringGreen|Snow|SlateGrey|SlateGray|SlateBlue|SkyBlue|Silver|Sienna|SeaShell|SeaGreen|SandyBrown|Salmon|SaddleBrown|RoyalBlue|RosyBrown|Red|Purple|PowderBlue|Plum|Pink|Peru|PeachPuff|PapayaWhip|PaleVioletRed|PaleTurquoise|PaleGreen|PaleGoldenRod|Orchid|OrangeRed|Orange|OliveDrab|Olive|OldLace|Navy|NavajoWhite|Moccasin|MistyRose|MintCream|MidnightBlue|MediumVioletRed|MediumTurquoise|MediumSpringGreen|MediumSlateBlue|MediumSeaGreen|MediumPurple|MediumOrchid|MediumBlue|MediumAquaMarine|Maroon|Magenta|Linen|LimeGreen|Lime|LightYellow|LightSteelBlue|LightSlateGrey|LightSlateGray|LightSkyBlue|LightSeaGreen|LightSalmon|LightPink|LightGrey|LightGreen|LightGray|LightGoldenRodYellow|LightCyan|LightCoral|LightBlue|LemonChiffon|LawnGreen|LavenderBlush|Lavender|Khaki|Ivory|Indigo|IndianRed|HotPink|HoneyDew|Grey|GreenYellow|Green|Gray|GoldenRod|Gold|GhostWhite|Gainsboro|Fuchsia|ForestGreen|FloralWhite|FireBrick|DodgerBlue|DimGrey|DimGray|DeepSkyBlue|DeepPink|Darkorange|DarkViolet|DarkTurquoise|DarkSlateGrey|DarkSlateGray|DarkSlateBlue|DarkSeaGreen|DarkSalmon|DarkRed|DarkOrchid|DarkOliveGreen|DarkMagenta|DarkKhaki|DarkGrey|DarkGreen|DarkGray|DarkGoldenRod|DarkCyan|DarkBlue|Cyan|Crimson|Cornsilk|CornflowerBlue|Coral|Chocolate|Chartreuse|CadetBlue|BurlyWood|Brown|BlueViolet|Blue|BlanchedAlmond|Black|Bisque|Beige|Azure|Aquamarine|Aqua|AntiqueWhite|AliceBlue)\b/ + , _style: "color: green;" + } + } +} diff --git a/js/jquery/chili/html.js b/js/jquery/chili/html.js new file mode 100755 index 0000000000..69f43a86d2 --- /dev/null +++ b/js/jquery/chili/html.js @@ -0,0 +1,80 @@ +/* +=============================================================================== +Chili is the jQuery code highlighter plugin +............................................................................... +LICENSE: http://www.opensource.org/licenses/mit-license.php +WEBSITE: http://noteslog.com/chili/ + + Copyright 2008 / Andrea Ercolino +=============================================================================== +*/ + +{ + _name: 'html' + , _case: false + , _main: { + doctype: { + _match: // + , _style: "color: #CC6600;" + } + , ie_style: { + _match: /()/ + , _replace: function( all, open, content, close ) { + return "" + this.x( open ) + "" + + this.x( content, '//style' ) + + "" + this.x( close ) + ""; + } + , _style: "color: DarkSlateGray; font-weight: bold;" + } + , comment: { + _match: // + , _style: "color: #4040c2;" + } + , script: { + _match: /(]*>)([\w\W]*?)(<\/script\s*>)/ + , _replace: function( all, open, content, close ) { + return this.x( open, '//tag_start' ) + + this.x( content, 'js' ) + + this.x( close, '//tag_end' ); + } + } + , style: { + _match: /(]*>)([\w\W]*?)(<\/style\s*>)/ + , _replace: function( all, open, content, close ) { + return this.x( open, '//tag_start' ) + + this.x( content, 'css' ) + + this.x( close, '//tag_end' ); + } + } + // matches a starting tag of an element (with attrs) + // like "
" or "" + , tag_start: { + _match: /(<\w+)((?:[?%]>|[\w\W])*?)(\/>|>)/ + , _replace: function( all, open, content, close ) { + return "" + this.x( open ) + "" + + this.x( content, '/tag_attrs' ) + + "" + this.x( close ) + ""; + } + , _style: "color: navy; font-weight: bold;" + } + // matches an ending tag + // like "
" + , tag_end: { + _match: /<\/\w+\s*>|\/>/ + , _style: "color: navy;" + } + , entity: { + _match: /&\w+?;/ + , _style: "color: blue;" + } + } + , tag_attrs: { + // matches a name/value pair + attr: { + // before in $1, name in $2, between in $3, value in $4 + _match: /(\W*?)([\w-]+)(\s*=\s*)((?:\'[^\']*(?:\\.[^\']*)*\')|(?:\"[^\"]*(?:\\.[^\"]*)*\"))/ + , _replace: "$1$2$3$4" + , _style: { attr_name: "color: green;", attr_value: "color: maroon;" } + } + } +} diff --git a/js/jquery/chili/jquery.chili-2.2.js b/js/jquery/chili/jquery.chili-2.2.js new file mode 100755 index 0000000000..bb0e4abae3 --- /dev/null +++ b/js/jquery/chili/jquery.chili-2.2.js @@ -0,0 +1,704 @@ +/* +=============================================================================== +Chili is the jQuery code highlighter plugin +............................................................................... +LICENSE: http://www.opensource.org/licenses/mit-license.php +WEBSITE: http://noteslog.com/chili/ + + Copyright 2008 / Andrea Ercolino +=============================================================================== +*/ + + +( function($) { + +ChiliBook = { //implied global + + version: "2.2" // 2008-07-06 + +// options -------------------------------------------------------------------- + + , automatic: true + , automaticSelector: "pre" + + , lineNumbers: !true + + , codeLanguage: function( el ) { + var recipeName = $( el ).attr( "class" ); + return recipeName ? recipeName : ''; + } + + , recipeLoading: true + , recipeFolder: "" // used like: recipeFolder + recipeName + '.js' + + // IE and FF convert   to " ", Safari and Opera do not + , replaceSpace: " " + , replaceTab: "    " + , replaceNewLine: " 
" + + , selectionStyle: [ "position:absolute; z-index:3000; overflow:scroll;" + , "width:16em;" + , "height:9em;" + , "border:1px solid gray;" + , "padding:15px;" + , "background-color:yellow;" + ].join( ' ' ) + +// ------------------------------------------------------------- end of options + + , defaultReplacement: '$$' // TODO: make this an option again + , recipes: {} //repository + , queue: {} //registry + + , unique: function() { + return (new Date()).valueOf(); + } +}; + + + +$.fn.chili = function( options ) { + var book = $.extend( {}, ChiliBook, options || {} ); + + function cook( ingredients, recipe, blockName ) { + + function prepareBlock( recipe, blockName ) { + var steps = []; + for( var stepName in recipe[ blockName ] ) { + steps.push( prepareStep( recipe, blockName, stepName ) ); + } + return steps; + } // prepareBlock + + function prepareStep( recipe, blockName, stepName ) { + var step = recipe[ blockName ][ stepName ]; + var exp = ( typeof step._match == "string" ) ? step._match : step._match.source; + return { + recipe: recipe + , blockName: blockName + , stepName: stepName + , exp: "(" + exp + ")" + , length: 1 // add 1 to account for the newly added parentheses + + (exp // count number of submatches in here + .replace( /\\./g, "%" ) // disable any escaped character + .replace( /\[.*?\]/g, "%" ) // disable any character class + .match( /\((?!\?)/g ) // match any open parenthesis, not followed by a ? + || [] // make sure it is an empty array if there are no matches + ).length // get the number of matches + , replacement: step._replace ? step._replace : book.defaultReplacement + }; + } // prepareStep + + function knowHow( steps ) { + var prevLength = 1; + var exps = []; + for (var i = 0; i < steps.length; i++) { + var exp = steps[ i ].exp; + // adjust backreferences + exp = exp.replace( /\\\\|\\(\d+)/g, function( m, aNum ) { + return !aNum ? m : "\\" + ( prevLength + 1 + parseInt( aNum, 10 ) ); + } ); + exps.push( exp ); + prevLength += steps[ i ].length; + } + var prolog = '((?:\\s|\\S)*?)'; + var epilog = '((?:\\s|\\S)+)'; + var source = '(?:' + exps.join( "|" ) + ')'; + source = prolog + source + '|' + epilog; + return new RegExp( source, recipe._case ? "g" : "gi" ); + } // knowHow + + function escapeHTML( str ) { + return str.replace( /&/g, "&" ).replace( /' + filter( subject ) + ''; + } + return filter( subject ); + } + else { + return filter( subject ); + } + } + } // applyModule + + function addPrefix( prefix, replacement ) { + var aux = replacement.replace( /()/ig, "$1" + prefix + "__$3" ); + return aux; + } // addPrefix + + function chef() { + if (! arguments[ 0 ]) { + return ''; + } + var steps = this.steps; + var i = 0; // iterate steps + var j = 2; // iterate chef's arguments + var prolog = arguments[ 1 ]; + var epilog = arguments[ arguments.length - 3 ]; + if (! epilog) { + var step; + while( step = steps[ i++ ] ) { + var aux = arguments; // this unmasks chef's arguments inside the next function + if( aux[ j ] ) { + var replacement = ''; + if( $.isFunction( step.replacement ) ) { + var matches = []; //Array.slice.call( aux, j, step.length ); + for (var k = 0, kTop = step.length; k < kTop; k++) { + matches.push( aux[ j + k ] ); + } + matches.push( aux[ aux.length - 2 ] ); + matches.push( aux[ aux.length - 1 ] ); + replacement = step.replacement + .apply( { + x: function() { + var subject = arguments[0]; + var module = arguments[1]; + var context = { + recipe: step.recipe + , blockName: step.blockName + }; + return applyModule( subject, module, context ); + } + }, matches ); + } + else { //we expect step.replacement to be a string + replacement = step.replacement + .replace( /(\\\$)|(?:\$\$)|(?:\$(\d+))/g, function( m, escaped, K ) { + if( escaped ) { /* \$ */ + return "$"; + } + else if( !K ) { /* $$ */ + return filter( aux[ j ] ); + } + else if( K == "0" ) { /* $0 */ + return step.stepName; + } + else { /* $K */ + return filter( aux[ j + parseInt( K, 10 ) ] ); + } + } ); + } + replacement = addPrefix( step.recipe._name, replacement ); + return filter( prolog ) + replacement; + } + else { + j+= step.length; + } + } + } + else { + return filter( epilog ); + } + } // chef + + if( ! blockName ) { + blockName = '_main'; + checkSpices( recipe ); + } + if( ! (blockName in recipe) ) { + return filter( ingredients ); + } + var replaceSpace = book.replaceSpace; + var steps = prepareBlock( recipe, blockName ); + var kh = knowHow( steps ); + var perfect = ingredients.replace( kh, function() { + return chef.apply( { steps: steps }, arguments ); + } ); + return perfect; + + } // cook + + function loadStylesheetInline( sourceCode ) { + if( document.createElement ) { + var e = document.createElement( "style" ); + e.type = "text/css"; + if( e.styleSheet ) { // IE + e.styleSheet.cssText = sourceCode; + } + else { + var t = document.createTextNode( sourceCode ); + e.appendChild( t ); + } + document.getElementsByTagName( "head" )[0].appendChild( e ); + } + } // loadStylesheetInline + + function checkSpices( recipe ) { + var name = recipe._name; + if( ! book.queue[ name ] ) { + + var content = ['/* Chili -- ' + name + ' */']; + for (var blockName in recipe) { + if( blockName.search( /^_(?!main\b)/ ) < 0 ) { + for (var stepName in recipe[ blockName ]) { + var step = recipe[ blockName ][ stepName ]; + if( '_style' in step ) { + if( step[ '_style' ].constructor == String ) { + content.push( '.' + name + '__' + stepName + ' { ' + step[ '_style' ] + ' }' ); + } + else { + for (var className in step[ '_style' ]) { + content.push( '.' + name + '__' + className + ' { ' + step[ '_style' ][ className ] + ' }' ); + } + } + } + } + } + } + content = content.join('\n'); + + loadStylesheetInline( content ); + + book.queue[ name ] = true; + } + } // checkSpices + + function askDish( el ) { + var recipeName = book.codeLanguage( el ); + if( '' != recipeName ) { + var path = getPath( recipeName ); + if( book.recipeLoading ) { + /* dynamic setups come here */ + if( ! book.queue[ path ] ) { + /* this is a new recipe to download */ + try { + book.queue[ path ] = [ el ]; + $.getJSON( path, function( recipeLoaded ) { + book.recipes[ path ] = recipeLoaded; + var q = book.queue[ path ]; + for( var i = 0, iTop = q.length; i < iTop; i++ ) { + makeDish( q[ i ], path ); + } + } ); + } + catch( recipeNotAvailable ) { + alert( "the recipe for '" + recipeName + "' was not found in '" + path + "'" ); + } + } + else { + /* not a new recipe, so just enqueue this element */ + book.queue[ path ].push( el ); + } + /* a recipe could have been already downloaded */ + makeDish( el, path ); + } + else { + /* static setups come here */ + makeDish( el, path ); + } + } + } // askDish + + function makeDish( el, recipePath ) { + var recipe = book.recipes[ recipePath ]; + if( ! recipe ) { + return; + } + var $el = $( el ); + var ingredients = $el.text(); + if( ! ingredients ) { + return; + } + + //fix for msie: \r (13) is used instead of \n (10) + //fix for opera: \r\n is used instead of \n + ingredients = ingredients.replace(/\r\n?/g, "\n"); + + //reverse fix for safari: msie, mozilla and opera render the initial \n + if( $el.parent().is('pre') ) { + if( ! $.browser.safari ) { + ingredients = ingredients.replace(/^\n/g, ""); + } + } + + var dish = cook( ingredients, recipe ); // all happens here + + if( book.replaceTab ) { + dish = dish.replace( /\t/g, book.replaceTab ); + } + if( book.replaceNewLine ) { + dish = dish.replace( /\n/g, book.replaceNewLine ); + } + + el.innerHTML = dish; //much faster than $el.html( dish ); + //tried also the function replaceHtml from http://blog.stevenlevithan.com/archives/faster-than-innerhtml + //but it was not faster nor without sideffects (it was not possible to count spans into el) + + //opera and safari select PRE text correctly + if( $.browser.msie || $.browser.mozilla ) { + enableSelectionHelper( el ); + } + + var $that = $el.parent(); + var classes = $that.attr( 'class' ); + var ln = /ln-(\d+)-([\w][\w\-]*)|ln-(\d+)|ln-/.exec( classes ); + if( ln ) { + addLineNumbers( el ); + var start = 0; + if( ln[1] ) { + start = parseInt( ln[1], 10 ); + var $pieces = $( '.ln-' + ln[1] + '-' + ln[2] ); + var pos = $pieces.index( $that[0] ); + $pieces.slice( 0, pos ).each( function() { + start += $( this ).find( 'li' ).length; + } ); + } + else if( ln[3] ) { + start = parseInt( ln[3], 10 ); + } + else { + start = 1; + } + $el.find( 'ol' )[0].start = start; + $('body').width( $('body').width() - 1 ).width( $('body').width() + 1 ); + } + else if( book.lineNumbers ) { + addLineNumbers( el ); + } + + } // makeDish + + function enableSelectionHelper( el ) { + var element = null; + $( el ) + .parents() + .filter( "pre" ) + .bind( "mousedown", function() { + element = this; + if( $.browser.msie ) { + document.selection.empty(); + } + else { + window.getSelection().removeAllRanges(); + } + } ) + .bind( "mouseup", function( event ) { + if( element && (element == this) ) { + element = null; + var selected = ''; + if( $.browser.msie ) { + selected = document.selection.createRange().htmlText; + if( '' == selected ) { + return; + } + selected = preserveNewLines( selected ); + var container_tag = '