Skip to content

Commit

Permalink
MINOR Updated history-js dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Dec 14, 2011
1 parent a17e1c2 commit f57caec
Show file tree
Hide file tree
Showing 77 changed files with 27,950 additions and 798 deletions.
2 changes: 1 addition & 1 deletion admin/thirdparty/history-js/.piston.yml
@@ -1,7 +1,7 @@
---
format: 1
handler:
commit: 861b4b1f7240b9d5e50d560ba5b94de78aa439e5
commit: 40489d12a52ea377a48fee53a34bc2ebb40bcb74
branch: master
lock: false
repository_class: Piston::Git::Repository
Expand Down
167 changes: 88 additions & 79 deletions admin/thirdparty/history-js/README.md

Large diffs are not rendered by default.

281 changes: 281 additions & 0 deletions admin/thirdparty/history-js/buildr.coffee
@@ -0,0 +1,281 @@
# Requires
buildr = require 'buildr'
util = require 'util'

# Options
options =
watch: false
compress: true

# Configs
configs =
standard:
# Options
name: 'standard'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'
outPath: __dirname+'/scripts/compressed'

# Checking
checkScripts: true
jshintOptions:
browser: true
laxbreak: true
boss: true
undef: true
onevar: true
strict: true
noarg: true

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

other: [

# -----------------------------
# JQUERY

{
# Options
name: 'html4+html5+jquery'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'json2.js'
'history.adapter.jquery.js'
'history.html4.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html4+html5/jquery.history.js'
}
{
# Options
name: 'html5+jquery'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'history.adapter.jquery.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html5/jquery.history.js'
}


# -----------------------------
# MOOTOOLS

{
# Options
name: 'html4+html5+mootools'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'json2.js'
'history.adapter.mootools.js'
'history.html4.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html4+html5/mootools.history.js'
}
{
# Options
name: 'html5+mootools'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'history.adapter.mootools.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html5/mootools.history.js'
}


# -----------------------------
# NATIVE

{
# Options
name: 'html4+html5+native'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'json2.js'
'history.adapter.native.js'
'history.html4.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html4+html5/native.history.js'
}
{
# Options
name: 'html5+native'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'history.adapter.native.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html5/native.history.js'
}


# -----------------------------
# RIGHT.JS

{
# Options
name: 'html4+html5+right'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'json2.js'
'history.adapter.right.js'
'history.html4.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html4+html5/right.history.js'
}
{
# Options
name: 'html5+right'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'history.adapter.right.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html5/right.history.js'
}


# -----------------------------
# ZEPTO

{
# Options
name: 'html4+html5+zepto'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'json2.js'
'history.adapter.zepto.js'
'history.html4.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html4+html5/zepto.history.js'
}
{
# Options
name: 'html5+zepto'
watch: options.watch

# Paths
srcPath: __dirname+'/scripts/uncompressed'

# Compression (without outPath only the generated bundle files are compressed)
compressScripts: options.compress # Array or true or false

# Order
scriptsOrder: [
'history.adapter.zepto.js'
'history.js'
]

# Bundling
bundleScriptPath: __dirname+'/scripts/bundled/html5/zepto.history.js'
}
]

# Standard
standardConfig = configs.standard
standardConfig.successHandler = ->
for config in configs.other
buildrInstance = buildr.createInstance config
buildrInstance.process()

# Process
standardBuildr = buildr.createInstance configs.standard
standardBuildr.process()
58 changes: 58 additions & 0 deletions admin/thirdparty/history-js/demo/bcherry-orig.html
@@ -0,0 +1,58 @@

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />

<title>WebKit is Dropping HTML5 "popstate" Events</title>

<link rel="stylesheet" href="/static/lib/css/blueprint/blueprint.min.css" media="screen, projection" />
<link rel="stylesheet" href="/static/lib/css/blueprint/print.min.css" media="print" />
<!--[if lt IE 8]>
<link rel="stylesheet" href="/static/lib/css/blueprint/ie.min.css" media="screen, projection">
<![endif]-->
<link href="/static/lib/css/bcherry.css" rel="stylesheet" media="screen" />
<style>
#n {
font-size: 48px;
}
p {
padding: 0 20px;
}
</style>

<script type="text/javascript" src="../vendor/jquery.js"></script>
<script type="text/javascript" src="../scripts/uncompressed/history.adapter.jquery.js"></script>
<script type="text/javascript" src="../scripts/uncompressed/history.js"></script>

</head>
<body>
<div id="n"></div>
<p>There's a bug in the HTML5 "popstate" event, as implemented in WebKit (Safari and Chrome). View this page in one of those browsers. Your browser has had history entries added from #0 to #19 (you should start at #19). Hitting back/forward will navigate through these. On each URL, the large number above should reflect the hash value. If you hit back/forward quickly, you'll notice that your number gets out of sync with the URL. This is because WebKit is dropping popstate events (they are not firing). It seems to happen when outbound network requests are in progress when the user navigates in their browser happens. In this case, your browser is downloading an image that takes 1s to serve on every popstate, so you'll have to wait 1s between backs/forwards to have the feature work correctly. You could also cause constant network traffic by putting an image download in a setInterval, in which case your popstate events will never fire. This implementation simulates an AJAX application that makes a network request when you navigate between URLs using pushState/popstate. View the source for more info.</p>
<p>This was filed as <a href="https://bugs.webkit.org/show_bug.cgi?id=42940">Bug 42940</a> with WebKit on July 24, 2010. The Firefox 4 beta does not have this bug, which is good news.</p>
<p>This is put together by <a href="http://www.adequatelygood.com">Ben Cherry</a>. Ben is a front-end engineer at <a href="http://twitter.com/">Twitter</a>, and you can follow him at <a href="http://twitter.com/bcherry">@bcherry</a>.</p>
<script>
// Bind to popstate
$(window).bind("popstate", function(e) {
var State = e.state;

// log that this event was fired, and the current URL
if (window.console && window.console.log) {
console.log("popstate", State, window.location.href);
}
// update the page
$("#n").text(typeof State.n !== 'undefined' ? State.n : document.location.href);

// Make an outbound image request that will take 1s. This request seems to be the cause of dropped popstates.
// Removing this, or replacing it with something else, avoids the issue. Even if it's replaced with slow, blocking code (i.e. 1s of execution) events are not dropped.
(new Image()).src = "http://www.bcherry.net/playground/pushstate.jpg";
});

// Seed the browser history
for (var i = 0; i < 20; i++) {
window.history.pushState({n:i}, i, "?" + i);
$("#n").text(i);
}
</script>
</body>
</html>

0 comments on commit f57caec

Please sign in to comment.