This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cross browser, backward compatible solution | |
(function( window, Date ) { | |
// feature testing | |
var raf = window.mozRequestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
window.oRequestAnimationFrame; | |
window.animLoop = function( render, element ) { | |
var running, lastFrame = +new Date; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function serverReachable() { | |
// IE vs. standard XHR creation | |
var x = new ( window.ActiveXObject || XMLHttpRequest )( "Microsoft.XMLHTTP" ), | |
s; | |
x.open( | |
// requesting the headers is faster, and just enough | |
"HEAD", | |
// append a random string to the current hostname, | |
// to make sure we're not hitting the cache | |
"//" + window.location.hostname + "/?rand=" + Math.random(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var elemDisplays = {}, | |
// Store the iframe outside the function to reuse it | |
iframe, iframeDoc; | |
function defaultDisplay( nodeName ) { | |
if ( !elemDisplays[ nodeName ] ) { | |
// Try the classical method first, which is far faster | |
var elem = document.createElement( nodeName ), | |
display; | |
document.body.appendChild( elem ); | |
display = window.getComputedStyle( elem ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fakeXMLHttpRequest() { | |
var self = this; | |
this.upload = { | |
addEventListener: function(evt, cb) { | |
self.progressListener = cb; | |
} | |
} | |
this.open = function() {}; | |
this.overrideMimeType = function() {}; | |
this.loaded = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an EventSource object, | |
// passing it the URL of the server sccript | |
var evtSrc = new EventSource( "server.php" ); | |
// Listen for messages/events on the EventSource | |
evtSrc.onmessage = function ( e ) { | |
addMessage( "status", JSON.parse(e.data) ); | |
} | |
evtSrc.addEventListener("checkin", function( e ) { | |
addMessage( "checkin", JSON.parse(e.data) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>Over and Out test page</title> | |
<link rel="stylesheet" type="text/css" media="all" href="shCore.css" /> | |
<link rel="stylesheet" type="text/css" media="all" href="shThemeFadeToGrey.css" /> | |
<style> | |
.deco { | |
padding: 5px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* We are defining the "timeline" of the animation, | |
* each line representing a keyframe. | |
*/ | |
@-moz-keyframes bounce { | |
/* Translate the element 400px to the right */ | |
/* Here we are animating "-moz-tranform", | |
* but most CSS properties can be animated: | |
* width, color, font-size, box-shadow, ... | |
*/ | |
from { -moz-transform: translate(0px); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(jQuery){ | |
// This shortTermMemory will contain the last parsed simple selector. | |
// To be usefull it needs to be accessed faster than it would take to re-parse the selector. | |
// Selectors are to complex to serve as keys of a hash, and a bi-dimensional array would be too slow. | |
// I'm wondering if .data() would be fast enough for that purpose. | |
var shortTermMemory = []; | |
jQuery.fn.extend({ | |
closest: function( selector, context ) { |
NewerOlder