This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
104 changed files
with
5,805 additions
and
50,274 deletions.
There are no files selected for viewing
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,11 @@ | |||
install: | |||
npm install | |||
|
|||
test: | |||
./tests/runner.sh | |||
|
|||
jenkins: | |||
./tests/runner.sh | |||
|
|||
all: | |||
install |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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/). |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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.
Oops, something went wrong.