Permalink
Browse files

Initial commit.

v1.1
  • Loading branch information...
1 parent 2ddc9fd commit dcec9c90801a7c5e3535b6679ad9fd1a17a3f738 Ryan J Daw committed Jun 1, 2012
Showing with 5,805 additions and 50,274 deletions.
  1. +0 −21 LICENSE
  2. +11 −0 Makefile
  3. +1 −1 README.md
  4. +0 −22 api-browser.konf
  5. +0 −7 api-client.konf
  6. +0 −22 api-legacy.konf
  7. +0 −18 api-node.konf
  8. +0 −136 api/analytics.js
  9. +73 −0 api/ark.js
  10. 0 api/blank.js
  11. +364 −0 api/combo-caching.js
  12. +131 −0 api/combo-client.js
  13. +15 −0 api/config.js
  14. +26 −21 api/cont.js
  15. +0 −367 api/data.js
  16. +33 −29 api/data2.js
  17. +0 −131 api/deferrable.js
  18. +13 −76 api/enhance.js
  19. +72 −125 api/externals.js
  20. +94 −0 api/extractDOM.js
  21. +136 −0 api/extractHTML.js
  22. +36 −0 api/logging.js
  23. +62 −250 api/main.js
  24. +8 −12 api/noconflict.js
  25. +65 −0 api/orientation.js
  26. +19 −0 api/persistHash.js
  27. +98 −0 api/resizeImages.js
  28. +7 −6 api/stack.js
  29. +58 −0 api/studioJS.js
  30. +11 −28 { → api}/timing.js
  31. +143 −167 api/tmpl.js
  32. +31 −181 api/util.js
  33. +0 −1 init.js
  34. +75 −0 konf/base.konf
  35. +1 −2 lib/defaultConf.konf → konf/defaults.konf
  36. +0 −1,011 lib/backbone.js
  37. +2 −93 lib/base_konf.konf
  38. +0 −14 lib/base_legacy_konf.konf
  39. +0 −267 lib/debug.js
  40. +0 −207 lib/detect.konf
  41. +0 −132 lib/fy/bubble.html
  42. +0 −108 lib/fy/bubble.js
  43. +0 −126 lib/fy/bubble2.js
  44. +0 −61 lib/fy/menu.html
  45. +0 −64 lib/fy/menu.js
  46. +0 −42 lib/fy/slide.html
  47. +0 −8,376 lib/jquery-1.5.2.js
  48. +0 −8,981 lib/jquery-1.6.2.js
  49. +0 −9,046 lib/jquery-1.6.4.js
  50. +0 −8,865 lib/jquery-1.6.js
  51. +0 −5,144 lib/jquery-base-1.5.2.js
  52. +0 −1 lib/jquery-latest.js
  53. +0 −99 lib/jquery/jquery.cookie.js
  54. +0 −29 lib/jquery/jquery.mapattributes.js
  55. +0 −32 lib/jquery/jquery.outerhtml.js
  56. +0 −76 lib/jquery/jquery.tap.js
  57. +0 −480 lib/json2.js
  58. +0 −811 lib/livereload.js
  59. +0 −855 lib/underscore.js
  60. +0 −862 lib/zepto.js
  61. +15 −0 package.json
  62. +0 −46 test/detect-test.html
  63. +0 −71 test/enhance-test.html
  64. +0 −167 test/externals-test.html
  65. +0 −13 test/fixtures-externals/plaintext.html
  66. +0 −11 test/fixtures-unmobify/basic.html
  67. +0 −28 test/fixtures-unmobify/escaped.html
  68. +0 −33 test/fixtures-unmobify/legacy.html
  69. +0 −22 test/fixtures-unmobify/plaintext-leading-content.html
  70. +0 −26 test/fixtures-unmobify/plaintext-missing-body.html
  71. +0 −32 test/fixtures-unmobify/plaintext-missing-closing-head.html
  72. +0 −33 test/fixtures-unmobify/plaintext.html
  73. +0 −1,597 test/qunit/qunit.js
  74. +0 −17 test/test-server.js
  75. +0 −226 test/unmobify-test.html
  76. +105 −0 tests/combo.html
  77. +47 −0 tests/enhance.html
  78. +233 −0 tests/externals.html
  79. +37 −0 tests/extractDOM.html
  80. +4 −0 tests/fixtures/combo/combo-1.js
  81. +4 −0 tests/fixtures/combo/combo-2.js
  82. +4 −0 tests/fixtures/combo/combo-3.js
  83. +16 −0 tests/fixtures/combo/combo-iframe.html
  84. +10 −0 tests/fixtures/unmobify-basic.html
  85. +89 −0 tests/qunit/junit.js
  86. +12 −2 {test → tests}/qunit/qunit.css
  87. +1,803 −0 tests/qunit/qunit.js
  88. +69 −0 tests/resizeImages.html
  89. +64 −0 tests/runner.js
  90. +5 −0 tests/runner.sh
  91. +10 −0 tests/server.js
  92. 0 {test → tests}/util-test.html
  93. +0 −108 tmpl/analytics.tmpl
  94. +0 −19 tmpl/base_mobileHead.tmpl
  95. +67 −51 tmpl/base_root.tmpl
  96. +18 −0 tmpl/base_scripts.tmpl
  97. +224 −0 tmpl/combo_client.tmpl
  98. +17 −0 tmpl/legacy_root.tmpl
  99. +0 −358 unmobify.js
  100. +1 −0 vendor/bubble.js
  101. 0 {lib → vendor}/dust-core.js
  102. +16 −9 {lib/fy → vendor}/slide.js
  103. +76 −0 vendor/zepto.ie.js
  104. +1,274 −0 vendor/zepto.js
View
@@ -1,21 +0,0 @@
-Copyright (c) Mobify R&D Inc.
-http://www.mobify.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -0,0 +1,11 @@
+install:
+ npm install
+
+test:
+ ./tests/runner.sh
+
+jenkins:
+ ./tests/runner.sh
+
+all:
+ install
View
@@ -1,4 +1,4 @@
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/).
View
@@ -1,22 +0,0 @@
-{%rebase}
-
-{>"lib/jquery/jquery.cookie.js"/}
-{>"lib/jquery/jquery.outerhtml.js"/}
-{>"lib/jquery/jquery.mapattributes.js"/}
-{>"lib/dust-core.js"/}
-
-{>"api/analytics.js"/}
-{>"api/util.js"/}
-{>"api/externals.js"/}
-{>"unmobify.js"/}
-
-{>"api/data2.js"/}
-{>"api/stack.js"/}
-{>"api/cont.js"/}
-
-{>"api/tmpl.js"/}
-
-{>"api/enhance.js"/}
-{>"api/main.js"/}
-
-{/rebase}
View
@@ -1,7 +0,0 @@
-{%rebase}
-
-{>"api/analytics.js"/}
-{>"api/externals.js"/}
-{>"api/enhance.js"/}
-
-{/rebase}
View
@@ -1,22 +0,0 @@
-{%rebase}
-
-{>"lib/jquery/jquery.cookie.js"/}
-{>"lib/jquery/jquery.outerhtml.js"/}
-{>"lib/jquery/jquery.mapattributes.js"/}
-{>"lib/dust-core.js"/}
-
-{>"api/analytics.js"/}
-{>"api/util.js"/}
-{>"api/externals.js"/}
-{>"unmobify.js"/}
-
-{>"api/deferrable.js"/}
-{>"api/data.js"/}
-
-{>"api/tmpl.js"/}
-
-{>"api/enhance.js"/}
-
-{>"api/main.js"/}
-
-{/rebase}
View
@@ -1,18 +0,0 @@
-{%rebase}
-
-{>"lib/jquery/jquery.cookie.js"/}
-{>"lib/jquery/jquery.outerhtml.js"/}
-{>"lib/jquery/jquery.mapattributes.js"/}
-{>"lib/dust-core.js"/}
-
-{>"api/util.js"/}
-
-{>"api/data2.js"/}
-{>"api/stack.js"/}
-{>"api/cont.js"/}
-
-{>"api/tmpl.js"/}
-
-{>"api/main.js"/}
-
-{/rebase}
View
@@ -1,136 +0,0 @@
-/* DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED */
-/* DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED */
-
-/* This is now only used by api-legacy js konfs. Look at analytics.tmpl in the
- template directory for up to date info. */
-
-/* DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED */
-/* DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED */
-
-
-// TODO: It would be nice if these scripts were more natural in the mobify.js flow.
-// TODO: Rename these functions, they're not just about GA anymore.
-(function($, _) {
- window._gaq = window._gaq || [];
-
- var ga = Mobify.ga = {
-
- init: function() {
- // Load time rounded to nearest 100ms.
- var ed = Mobify.evaluatedData;
- var start;
- try {
- start = Mobify.timing.points[0][0];
- } catch (err) {
- start = undefined;
- }
-
- var loadTime = Math.round((Mobify.timing.addPoint('Done') - start) / 100) * 100;
- var template = ed.bodyType || ed.rootPageType || 'miss';
- //var buildDate = (ed.siteConfig.buildDate || (ed && ed.buildDate)) + '';
- var buildDate = (
- (ed.siteConfig && ed.siteConfig.buildDate) ||
- (ed.buildDate)
- ) + '';
-
- // http://code.google.com/apis/analytics/docs/tracking/gaTrackingCustomVariables.html
- // _setCustomVar scope levels:
- // 1 => Visitor
- // 2 => Session
- // 3 => Page (default)
-
- // TODO: If they have multiple domains we need to configure a single tracking.
-
- // this looks weird but it's populated down in the push: definition
- var ga_args = [['_setAccount', null]];
- // If we have site or konf specified args, populate them here, otherwise assume domain 'none'
- // Corollory: this means site specified arguments should ALWAYS include _setDomainName
-
- var ga_domain = (function(hostname, domain_dict){
- var domain = 'none';
- if (! domain_dict) return domain;
- var hostname_parts = hostname.split('.');
-
- while (hostname_parts.length > 0) {
- domain = domain_dict[hostname_parts.join('_')];
- if (!! domain) return domain;
- hostname_parts = hostname_parts.slice(1); // cut off the head and continue
- }
- // fallback, domain is set to 'none'
- return domain;
- })(window.location.hostname, (!! ed.siteConfig) ? ed.siteConfig.ga_domains : false );
- ga_args.push(['_setDomainName', ((ga_domain === 'none') ? '' : '.') + ga_domain]);
-
- var site_args = ed.gaOptions || ((!! (ed.siteConfig && ed.siteConfig.ga_options)) ? ed.siteConfig.ga_options : []);
-
- // Our custom variables, some of which aren't currently being populated properly (timing, build_dt)
- var ga_final = [
- ['_setCustomVar', 1, 'loadTime', '' + loadTime],
- ['_setCustomVar', 2, 't', template],
- ['_setCustomVar', 3, 'build_dt', buildDate],
- ['_setCustomVar', 4, 'mobi', 'y', 1],
- ['_trackPageview'],
- ['_trackPageLoadTime']
- ];
-
- var ga_args_array = ga_args.concat(site_args, ga_final);
- ga.push.apply(this, ga_args_array);
-
- var insertAt = document.getElementsByTagName('script')[0] || document.getElementsByTagName('head')[0];
- var isSSL = location.protocol[4] == 's';
-
- // JB: Would this ever really happen?
- // PM: If clients aren't using GA in their site, yes. (Many ecommerce sites don't use GA.)
- // QA Tracking. Load the QA script if its not already loaded.
- if (!window._gat) {
- var gaScript = document.createElement('script');
- gaScript.onload = gaScript.onreadystatechange = ga.load;
- gaScript.src = '//' + (isSSL ? 'ssl' : 'www') + '.google-analytics.com/ga.js';
- insertAt.parentNode.insertBefore(gaScript, insertAt);
- } else {
- ga.load();
- }
-
- // Quantcast Tracking
- var _qevents = window._qevents = window._qevents || [];
- var qcScript = document.createElement('script');
- qcScript.src = '//' + (isSSL ? 'secure' : 'edge') + '.quantserve.com/quant.js';
- insertAt.parentNode.insertBefore(qcScript, insertAt);
-
- _qevents.push({qacct:"p-eb0xvejp1OUw6"});
- },
-
- load: function() {
- if (ga.loaded) return;
- ga.loaded = true;
- ga.push.apply(null, ga.q);
- // Don't queue anymore.
- ga.queue = ga.push;
- },
-
- loaded: false,
-
- // Queue arguments to be pushed to _gaq on ga.load.
- queue: function() {
- [].push.apply(ga.q, [].slice.call(arguments));
- },
-
- q: [],
-
- // Iterates through arguments and pushes them to _gaq.
- // Replaces null values with gaId.
- push: function() {
- var ed = Mobify.evaluatedData;
- var args = [].slice.call(arguments);
- _.each(ed.gaId || ((!! (ed.siteConfig && ed.siteConfig.ga_account)) ? [ed.siteConfig.ga_account] : false) || [], function(gaId, i) {
- var prefix = 'MOBIFY' + i;
- _.each(args, function(arg, j) {
- var data = arg.slice(0);
- data[0] = prefix + '.' + data[0];
- if (data[1] === null) data[1] = gaId;
- _gaq.push(data);
- });
- });
- }
- };
-})(Mobify.$, Mobify._);
View
@@ -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);
View
No changes.
Oops, something went wrong.

0 comments on commit dcec9c9

Please sign in to comment.