diff --git a/README.md b/README.md deleted file mode 100644 index 3be0145..0000000 --- a/README.md +++ /dev/null @@ -1,52 +0,0 @@ -## Usage -jquery.typer.js can be used one of two ways: - -### Type once with typeTo() - -If you just want to use the effect once, use `typeTo()`. It can be used as follows: - -```javascript -$('h3').typeTo("New Text"); -``` - -This will do a one-time transition. - -### Type indefinitely with typer() - -Now let's say you want to loop over a set of strings for the typing effect. Easy! - -```javascript -$('[data-typer-targets]').typer(); -``` - -That code will start the effect on all elements with the `data-typer-targets` attribute. - -You obviously need to supply it with some source data. The `data-typer-targets` attribute can be either a comma-separated string or a piece of JSON. - -### Options - -There are some options that are available to you as well: - -```javascript -// Defaults -{ - highlightSpeed : 20, - typeSpeed : 100, - clearDelay : 500, - typeDelay : 200, - clearOnHighlight : true, - typerDataAttr : 'data-typer-targets', - typerInterval : 2000 -} -``` - -Set the options individually: - -```javascript -$.typer.options.highlightSpeed = 500; -``` -## About - -jquery.typer.js was originally developed for [LayerVault](http://layervault.com) by [Kelly Sutton](http://kellysutton.com). - -You can see more projects from LayerVault in the [LayerVault Cosmos](http://cosmos.layervault.com). diff --git a/bower.json b/bower.json deleted file mode 100644 index 5f852d4..0000000 --- a/bower.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "jquery.typer", - "version": "0.0.0", - "main": "./src/jquery.typer.js", - "dependencies": { - } -} diff --git a/images/bkg.png b/images/bkg.png new file mode 100644 index 0000000..fcebb5b Binary files /dev/null and b/images/bkg.png differ diff --git a/images/blacktocat.png b/images/blacktocat.png new file mode 100644 index 0000000..273d571 Binary files /dev/null and b/images/blacktocat.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..2302d1d --- /dev/null +++ b/index.html @@ -0,0 +1,94 @@ + + + + + + + + + + + jquery.typer.js by layervault + + + + + + +
+
+

jquery.typer.js

+

A simple jQuery plugin for a slick typing effect.

+ +
+ Download as .zip + Download as .tar.gz + View on GitHub +
+
+
+ +
+
+

Usage

+ +

jquery.typer.js can be used one of two ways:

+ +

Type once with typeTo()

+ +

If you just want to use the effect once, you should use typeTo(). It can be used as follows:

+ +
$('h3').typeTo("New Text");
+ +

This will do a one-time transition.

+ +

Type indefinitely with typer()

+ +

Now let's say you want to loop over a set of strings for the typing effect. Easy!

+ +
 $('[data-typer-targets]').typer() 
+ +

That code will start the effect on all elements with the data-typer-targets attribute.

+ +

You obviously need to supply it with some source data. The data-typer-targets attribute can be + either a comma-separated string or a piece of JSON.

+ +

Customize

+ +

There are a few options that you can customize.

+ +
  $.typer.options = {
+      highlightSpeed    : 20,
+      typeSpeed         : 100,
+      clearDelay        : 500,
+      typeDelay         : 200,
+      clearOnHighlight  : true,
+      typerDataAttr     : 'data-typer-targets',
+      typerInterval     : 2000
+  };
+ +

Set them individually:

+ +
  $.typer.options.highlightSpeed = 1000; 
+ +

Or as a whole:

+ +
  $.typer.options = {
+      typeSpeed: 10,
+      typerDataAttr: 'data-values'
+  }; 
+ +

Options must be set before invoking typer() or typeTo()

+ +

Created by Allan Grinshtein and Kelly Sutton of LayerVault.

+

Released under the MIT license.

+
+
+ + + + \ No newline at end of file diff --git a/javascripts/main.js b/javascripts/main.js new file mode 100644 index 0000000..d8135d3 --- /dev/null +++ b/javascripts/main.js @@ -0,0 +1 @@ +console.log('This would be the main JS file.'); diff --git a/params.json b/params.json new file mode 100644 index 0000000..1bc8a09 --- /dev/null +++ b/params.json @@ -0,0 +1 @@ +{"body":"### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here using GitHub Flavored Markdown, select a template crafted by a designer, and publish. After your page is generated, you can check out the new branch:\r\n\r\n```\r\n$ cd your_repo_root/repo_name\r\n$ git fetch origin\r\n$ git checkout gh-pages\r\n```\r\n\r\nIf you're using the GitHub for Mac, simply sync your repository and you'll see the new branch.\r\n\r\n### Designer Templates\r\nWe've crafted some handsome templates for you to use. Go ahead and continue to layouts to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved if it remained markdown format.\r\n\r\n### Rather Drive Stick?\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator written by our own Tom Preston-Werner. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `` element will link to the contributor's GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out the documentation at http://help.github.com/pages or contact support@github.com and we’ll help you sort it out.","tagline":"A simple jQuery plugin for a slick typing effect.","google":"","note":"Don't delete this file! It's used internally to help with page regeneration.","name":"jquery.typer.js"} \ No newline at end of file diff --git a/src/jquery.typer.js b/src/jquery.typer.js deleted file mode 100644 index d1520cc..0000000 --- a/src/jquery.typer.js +++ /dev/null @@ -1,260 +0,0 @@ -String.prototype.rightChars = function(n){ - if (n <= 0) { - return ""; - } - else if (n > this.length) { - return this; - } - else { - return this.substring(this.length, this.length - n); - } -}; - -(function($) { - var - options = { - highlightSpeed : 20, - typeSpeed : 100, - clearDelay : 500, - typeDelay : 200, - clearOnHighlight : true, - typerDataAttr : 'data-typer-targets', - typerInterval : 2000 - }, - highlight, - clearText, - backspace, - type, - spanWithColor, - clearDelay, - typeDelay, - clearData, - isNumber, - typeWithAttribute, - getHighlightInterval, - getTypeInterval, - typerInterval; - - spanWithColor = function(color, backgroundColor) { - if (color === 'rgba(0, 0, 0, 0)') { - color = 'rgb(255, 255, 255)'; - } - - return $('') - .css('color', color) - .css('background-color', backgroundColor); - }; - - isNumber = function (n) { - return !isNaN(parseFloat(n)) && isFinite(n); - }; - - clearData = function ($e) { - $e.removeData([ - 'typePosition', - 'highlightPosition', - 'leftStop', - 'rightStop', - 'primaryColor', - 'backgroundColor', - 'text', - 'typing' - ]); - }; - - type = function ($e) { - var - // position = $e.data('typePosition'), - text = $e.data('text'), - oldLeft = $e.data('oldLeft'), - oldRight = $e.data('oldRight'); - - // if (!isNumber(position)) { - // position = $e.data('leftStop'); - // } - - if (!text || text.length === 0) { - clearData($e); - return; - } - - - $e.text( - oldLeft + - text.charAt(0) + - oldRight - ).data({ - oldLeft: oldLeft + text.charAt(0), - text: text.substring(1) - }); - - // $e.text($e.text() + text.substring(position, position + 1)); - - // $e.data('typePosition', position + 1); - - setTimeout(function () { - type($e); - }, getTypeInterval()); - }; - - clearText = function ($e) { - $e.find('span').remove(); - - setTimeout(function () { - type($e); - }, typeDelay()); - }; - - highlight = function ($e) { - var - position = $e.data('highlightPosition'), - leftText, - highlightedText, - rightText; - - if (!isNumber(position)) { - position = $e.data('rightStop') + 1; - } - - if (position <= $e.data('leftStop')) { - setTimeout(function () { - clearText($e); - }, clearDelay()); - return; - } - - leftText = $e.text().substring(0, position - 1); - highlightedText = $e.text().substring(position - 1, $e.data('rightStop') + 1); - rightText = $e.text().substring($e.data('rightStop') + 1); - - $e.html(leftText) - .append( - spanWithColor( - $e.data('backgroundColor'), - $e.data('primaryColor') - ) - .append(highlightedText) - ) - .append(rightText); - - $e.data('highlightPosition', position - 1); - - setTimeout(function () { - return highlight($e); - }, getHighlightInterval()); - }; - - typeWithAttribute = function ($e) { - var targets; - - if ($e.data('typing')) { - return; - } - - try { - targets = JSON.parse($e.attr($.typer.options.typerDataAttr)).targets; - } catch (e) {} - - if (typeof targets === "undefined") { - targets = $.map($e.attr($.typer.options.typerDataAttr).split(','), function (e) { - return $.trim(e); - }); - } - - $e.typeTo(targets[Math.floor(Math.random()*targets.length)]); - }; - - // Expose our options to the world. - $.typer = (function () { - return { options: options }; - })(); - - $.extend($.typer, { - options: options - }); - - //-- Methods to attach to jQuery sets - - $.fn.typer = function() { - var $elements = $(this); - - return $elements.each(function () { - var $e = $(this); - - if (typeof $e.attr($.typer.options.typerDataAttr) === "undefined") { - return; - } - - typeWithAttribute($e); - setInterval(function () { - typeWithAttribute($e); - }, typerInterval()); - }); - }; - - $.fn.typeTo = function (newString) { - var - $e = $(this), - currentText = $e.text(), - i = 0, - j = 0; - - if (currentText === newString) { - console.log("Our strings our equal, nothing to type"); - return $e; - } - - if (currentText !== $e.html()) { - console.error("Typer does not work on elements with child elements."); - return $e; - } - - $e.data('typing', true); - - while (currentText.charAt(i) === newString.charAt(i)) { - i++; - } - - while (currentText.rightChars(j) === newString.rightChars(j)) { - j++; - } - - newString = newString.substring(i, newString.length - j + 1); - - $e.data({ - oldLeft: currentText.substring(0, i), - oldRight: currentText.rightChars(j - 1), - leftStop: i, - rightStop: currentText.length - j, - primaryColor: $e.css('color'), - backgroundColor: $e.css('background-color'), - text: newString - }); - - highlight($e); - - return $e; - }; - - //-- Helper methods. These can one day be customized further to include things like ranges of delays. - - getHighlightInterval = function () { - return $.typer.options.highlightSpeed; - }; - - getTypeInterval = function () { - return $.typer.options.typeSpeed; - }, - - clearDelay = function () { - return $.typer.options.clearDelay; - }, - - typeDelay = function () { - return $.typer.options.typeDelay; - }; - - typerInterval = function () { - return $.typer.options.typerInterval; - }; -})(jQuery); diff --git a/stylesheets/pygment_trac.css b/stylesheets/pygment_trac.css new file mode 100644 index 0000000..d1df6a2 --- /dev/null +++ b/stylesheets/pygment_trac.css @@ -0,0 +1,68 @@ +.highlight .c { color: #999988; font-style: italic } /* Comment */ +.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ +.highlight .k { font-weight: bold } /* Keyword */ +.highlight .o { font-weight: bold } /* Operator */ +.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */ +.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ +.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .gr { color: #aa0000 } /* Generic.Error */ +.highlight .gh { color: #999999 } /* Generic.Heading */ +.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ +.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #555555 } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */ +.highlight .gt { color: #aa0000 } /* Generic.Traceback */ +.highlight .kc { font-weight: bold } /* Keyword.Constant */ +.highlight .kd { font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */ +.highlight .m { color: #009999 } /* Literal.Number */ +.highlight .s { color: #d14 } /* Literal.String */ +.highlight .na { color: #008080 } /* Name.Attribute */ +.highlight .nb { color: #0086B3 } /* Name.Builtin */ +.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */ +.highlight .no { color: #008080 } /* Name.Constant */ +.highlight .ni { color: #800080 } /* Name.Entity */ +.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */ +.highlight .nn { color: #555555 } /* Name.Namespace */ +.highlight .nt { color: #CBDFFF } /* Name.Tag */ +.highlight .nv { color: #008080 } /* Name.Variable */ +.highlight .ow { font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mf { color: #009999 } /* Literal.Number.Float */ +.highlight .mh { color: #009999 } /* Literal.Number.Hex */ +.highlight .mi { color: #009999 } /* Literal.Number.Integer */ +.highlight .mo { color: #009999 } /* Literal.Number.Oct */ +.highlight .sb { color: #d14 } /* Literal.String.Backtick */ +.highlight .sc { color: #d14 } /* Literal.String.Char */ +.highlight .sd { color: #d14 } /* Literal.String.Doc */ +.highlight .s2 { color: #d14 } /* Literal.String.Double */ +.highlight .se { color: #d14 } /* Literal.String.Escape */ +.highlight .sh { color: #d14 } /* Literal.String.Heredoc */ +.highlight .si { color: #d14 } /* Literal.String.Interpol */ +.highlight .sx { color: #d14 } /* Literal.String.Other */ +.highlight .sr { color: #009926 } /* Literal.String.Regex */ +.highlight .s1 { color: #d14 } /* Literal.String.Single */ +.highlight .ss { color: #990073 } /* Literal.String.Symbol */ +.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */ +.highlight .vc { color: #008080 } /* Name.Variable.Class */ +.highlight .vg { color: #008080 } /* Name.Variable.Global */ +.highlight .vi { color: #008080 } /* Name.Variable.Instance */ +.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */ + +.type-csharp .highlight .k { color: #0000FF } +.type-csharp .highlight .kt { color: #0000FF } +.type-csharp .highlight .nf { color: #000000; font-weight: normal } +.type-csharp .highlight .nc { color: #2B91AF } +.type-csharp .highlight .nn { color: #000000 } +.type-csharp .highlight .s { color: #A31515 } +.type-csharp .highlight .sc { color: #A31515 } diff --git a/stylesheets/stylesheet.css b/stylesheets/stylesheet.css new file mode 100644 index 0000000..a54a639 --- /dev/null +++ b/stylesheets/stylesheet.css @@ -0,0 +1,247 @@ +body { + margin: 0; + padding: 0; + background: #151515 url("../images/bkg.png") 0 0; + color: #eaeaea; + font: 16px; + line-height: 1.5; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; +} + +/* General & 'Reset' Stuff */ + +.container { + width: 90%; + max-width: 600px; + margin: 0 auto; +} + +section { + display: block; + margin: 0 0 20px 0; +} + +h1, h2, h3, h4, h5, h6 { + margin: 0 0 20px; +} + +li { + line-height: 1.4 ; +} + +/* Header,
+ header - container + h1 - project name + h2 - project description +*/ + +header { + background: rgba(0, 0, 0, 0.1); + width: 100%; + border-bottom: 1px dashed #b5e853; + padding: 20px 0; + margin: 0 0 40px 0; +} + +header h1 { + font-size: 30px; + line-height: 1.5; + margin: 0 0 0 -40px; + font-weight: bold; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; + color: #b5e853; + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1), + 0 0 5px rgba(181, 232, 83, 0.1), + 0 0 10px rgba(181, 232, 83, 0.1); + letter-spacing: -1px; + -webkit-font-smoothing: antialiased; +} + +header h1:before { + content: "./ "; + font-size: 24px; +} + +header h2 { + font-size: 18px; + font-weight: 300; + color: #666; +} + +#downloads .btn { + display: inline-block; + text-align: center; + margin: 0; +} + +/* Main Content +*/ + +#main_content { + width: 100%; + -webkit-font-smoothing: antialiased; +} +section img { + max-width: 100% +} + +h1, h2, h3, h4, h5, h6 { + font-weight: normal; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; + color: #b5e853; + letter-spacing: -0.03em; + text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1), + 0 0 5px rgba(181, 232, 83, 0.1), + 0 0 10px rgba(181, 232, 83, 0.1); +} + +#main_content h1 { + font-size: 30px; +} + +#main_content h2 { + font-size: 24px; +} + +#main_content h3 { + font-size: 18px; +} + +#main_content h4 { + font-size: 14px; +} + +#main_content h5 { + font-size: 12px; + text-transform: uppercase; + margin: 0 0 5px 0; +} + +#main_content h6 { + font-size: 12px; + text-transform: uppercase; + color: #999; + margin: 0 0 5px 0; +} + +dt { + font-style: italic; + font-weight: bold; +} + +ul li { + list-style: none; +} + +ul li:before { + content: ">>"; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; + font-size: 13px; + color: #b5e853; + margin-left: -37px; + margin-right: 21px; + line-height: 16px; +} + +blockquote { + color: #aaa; + padding-left: 10px; + border-left: 1px dotted #666; +} + +pre { + background: rgba(0, 0, 0, 0.9); + border: 1px solid rgba(255, 255, 255, 0.15); + padding: 10px; + font-size: 14px; + color: #b5e853; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + text-wrap: normal; + overflow: auto; + overflow-y: hidden; +} + +table { + width: 100%; + margin: 0 0 20px 0; +} + +th { + text-align: left; + border-bottom: 1px dashed #b5e853; + padding: 5px 10px; +} + +td { + padding: 5px 10px; +} + +hr { + height: 0; + border: 0; + border-bottom: 1px dashed #b5e853; + color: #b5e853; +} + +/* Buttons +*/ + +.btn { + display: inline-block; + background: -webkit-linear-gradient(top, rgba(40, 40, 40, 0.3), rgba(35, 35, 35, 0.3) 50%, rgba(10, 10, 10, 0.3) 50%, rgba(0, 0, 0, 0.3)); + padding: 8px 18px; + border-radius: 50px; + border: 2px solid rgba(0, 0, 0, 0.7); + border-bottom: 2px solid rgba(0, 0, 0, 0.7); + border-top: 2px solid rgba(0, 0, 0, 1); + color: rgba(255, 255, 255, 0.8); + font-family: Helvetica, Arial, sans-serif; + font-weight: bold; + font-size: 13px; + text-decoration: none; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.75); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05); +} + +.btn:hover { + background: -webkit-linear-gradient(top, rgba(40, 40, 40, 0.6), rgba(35, 35, 35, 0.6) 50%, rgba(10, 10, 10, 0.8) 50%, rgba(0, 0, 0, 0.8)); +} + +.btn .icon { + display: inline-block; + width: 16px; + height: 16px; + margin: 1px 8px 0 0; + float: left; +} + +.btn-github .icon { + opacity: 0.6; + background: url("../images/blacktocat.png") 0 0 no-repeat; +} + +/* Links + a, a:hover, a:visited +*/ + +a { + color: #63c0f5; + text-shadow: 0 0 5px rgba(104, 182, 255, 0.5); +} + +/* Clearfix */ + +.cf:before, .cf:after { + content:""; + display:table; +} + +.cf:after { + clear:both; +} + +.cf { + zoom:1; +} \ No newline at end of file diff --git a/test.html b/test.html deleted file mode 100644 index a9311f0..0000000 --- a/test.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - -

Hello, World!

-

Welcome

- -

Welcome

- - - -