Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
v1.1
  • Loading branch information
Ryan J Daw committed Jun 1, 2012
1 parent 2ddc9fd commit dcec9c9
Show file tree
Hide file tree
Showing 104 changed files with 5,805 additions and 50,274 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

11 changes: 11 additions & 0 deletions Makefile
@@ -0,0 +1,11 @@
install:
npm install

test:
./tests/runner.sh

jenkins:
./tests/runner.sh

all:
install
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
Mobify.js Mobify.js
========= =========


For information on using Mobify.js see [http://portal.mobify.com/docs/](http://portal.mobify.com/docs/). For information on using Mobify.js see [http://cloud.mobify.com/](http://cloud.mobify.com/).
22 changes: 0 additions & 22 deletions api-browser.konf

This file was deleted.

7 changes: 0 additions & 7 deletions api-client.konf

This file was deleted.

22 changes: 0 additions & 22 deletions api-legacy.konf

This file was deleted.

18 changes: 0 additions & 18 deletions api-node.konf

This file was deleted.

136 changes: 0 additions & 136 deletions api/analytics.js

This file was deleted.

73 changes: 73 additions & 0 deletions api/ark.js
@@ -0,0 +1,73 @@
/* Ark saves scripts before the flood (document.open) and can restore them after.
*/
(function(Mobify) {

var contraband = {}

, index = 0

, nextId = function() {
return "_generatedID_" + index++;
}

// `document.open` wipes objects in all browsers but WebKit.
, documentOpenWipesObjects = !navigator.userAgent.match(/webkit/i)
, _store = function(name, fn) {
var bucket = contraband[name] = contraband[name] || [];
bucket.push(fn);
}

, ark = Mobify.ark = {
// Store a script in the ark.
// `name`: Storage key.
// `fn`: What to store.
// `passive`: Whether `fn` should be executed now or not.
store: function(name, fn, passive) {
if (typeof name == 'function') {
passive = fn;
fn = name;
name = nextId();
}

if (!passive && fn.call) {
if (documentOpenWipesObjects) {
_store(name, fn);
}
fn();
} else {
_store(name, fn);
}

}

// Returns the HTML to restore a script from the ark.
, load: function(sNames) {
var result = [];
if (sNames) {
var aNames = sNames.split(/[ ,]/);
for (var i = 0, l = aNames.length; i < l; ++i) {
var bucket = contraband[aNames[i]];
if (!bucket) continue;

for (var j = 0, bl = bucket.length; j < bl; ++j) {
var fn = bucket[j];
if (fn.call) fn = '(' + fn + ')()';
result.push('<script>' + fn + '</script>');
}
}
} else {
for (var key in contraband) {
result.push(Mobify.ark.load(key));
}
}
return result.join('\n');
}

// Dust helper to restore scripts from the ark.
, dustSection: function(chunk, context, bodies, params) {
var output = ark.load(params && params.name);
return chunk.write(output);
}
};

})(Mobify);
Empty file removed api/blank.js
Empty file.

0 comments on commit dcec9c9

Please sign in to comment.