` element markup.
6 | - Update to latest capturing fix that targets scroll jank bug fix on
7 | iOS8 and greater.
8 | 2.0.15
9 | - The previous iOS 8.0 scroll fix was causing some incompatibilities with
10 | certain websites. Introduces a new scroll fix that should work in all
11 | circumstances.
12 | - Also fixes an iOS 8.0 issue where if there are two sibling forms in the
13 | original document, one of the forms ends up as a child form in the
14 | captured document.
15 | 2.0.14
16 | - Added patch to fix scrolling jank on iOS 8.0.
17 | - Bumped the version of grunt-saucelabs and fixed tests to support the new
18 | version.
19 | - Fixed tests on Android 2.3.
20 | 2.0.13
21 | - Update image resizer to 1.0.2, which contains changes to default
22 | cache time (from 2 months down to 8 hours).
23 | - Don't patch anchor links on Firefox 29 and above.
24 | 2.0.12
25 | - `Capture.prototype.restore` uses self.all() instead of capturedDoc.
26 | 2.0.11
27 | - Updates `Capture.prototype.restore` to restore the captured doc.
28 | 2.0.10
29 | - Brings in utils, jazzcat, and imageresize as dependancies using Bower.
30 | 2.0.9
31 | - Fix for putting Mobify tag above head tag.
32 | 2.0.8
33 | - Change AMD definitions to UMD in all libs.
34 | 2.0.7
35 | - Allow specifying quality parameter without it defaulting the format
36 | to JPG.
37 | - Added a flag that allows you to turn resizing to auto/on/off.
38 | 2.0.6
39 | - Fixed issue where we were not passing in the prefix when
40 | using `render` with an HTML string, causing assets to not get enabled.
41 | 2.0.5
42 | - Add API for fixing Anchor Tags on Firefox when using Capturing.
43 | 2.0.4
44 | - Fixes iOS 4.3 / Safari 4 issue with placing Mobify tag above .
45 | 2.0.3
46 | - Adds a fix to ensure that meta tags do not get created and inserted
47 | into the for older Safari browsers.
48 | 2.0.2
49 | - Fixes iOS 4.3 / Safari 4 issue with document.head being undefined.
50 | 2.0.1
51 | - Changes getImageURL to grab default options if options object is not
52 | passed to it.
53 | 2.0.0
54 | - First stable release of 2.0 API!
55 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) Mobify R&D Inc.
2 | http://www.mobify.com/
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining
5 | a copy of this software and associated documentation files (the
6 | "Software"), to deal in the Software without restriction, including
7 | without limitation the rights to use, copy, modify, merge, publish,
8 | distribute, sublicense, and/or sell copies of the Software, and to
9 | permit persons to whom the Software is furnished to do so, subject to
10 | the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | install:
2 | #git submodule update --init
3 | npm uninstall -g grunt
4 | npm install -g grunt-cli bower
5 | npm install
6 | bower install
7 |
8 | test: install
9 | grunt test
10 |
11 | all:
12 | install
13 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: node server.js
2 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mobifyjs",
3 | "version": "2.0.16",
4 | "main": "build/mobify.min.js",
5 | "dependencies": {
6 | "capturejs": "1.0.4",
7 | "mobifyjs-utils": "1.0.0",
8 | "jazzcat-client": "1.0.0",
9 | "imageresize-client": "1.0.4",
10 | "css-optimize": "1.0.0"
11 | },
12 | "devDependencies": {
13 |
14 | },
15 | "ignore": [
16 | "node_modules",
17 | "tests",
18 | "performance",
19 | "examples",
20 | "www"
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/circle.yml:
--------------------------------------------------------------------------------
1 | test:
2 | pre:
3 | - make install
4 | override:
5 | - make test
6 |
--------------------------------------------------------------------------------
/examples/assets/css/stylesheet.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: 'Helvetica Neue', sans-serif;
3 | background: rgb(4, 111, 126);
4 | color: #d5ecf2;
5 | text-shadow: rgba(0,0,0,0.15) 0 2px 0;
6 | font-weight: 200;
7 | }
8 |
9 | a {
10 | color: #c07247;
11 | }
12 |
13 | img {
14 | padding-top: 20px;
15 | }
16 |
17 | .example .img {
18 | width: 35%;
19 | display: inline-block;
20 | box-sizing: border-box;
21 | }
22 |
--------------------------------------------------------------------------------
/examples/assets/images/alternate_art.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/alternate_art.png
--------------------------------------------------------------------------------
/examples/assets/images/extralarge.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/extralarge.jpg
--------------------------------------------------------------------------------
/examples/assets/images/forest.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/forest.jpg
--------------------------------------------------------------------------------
/examples/assets/images/grumpycat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/grumpycat.jpg
--------------------------------------------------------------------------------
/examples/assets/images/kitten.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/kitten.jpg
--------------------------------------------------------------------------------
/examples/assets/images/large.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/large.jpg
--------------------------------------------------------------------------------
/examples/assets/images/leaves-big.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/leaves-big.jpg
--------------------------------------------------------------------------------
/examples/assets/images/leaves-small.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/leaves-small.jpg
--------------------------------------------------------------------------------
/examples/assets/images/medium.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/medium.jpg
--------------------------------------------------------------------------------
/examples/assets/images/mountains.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/mountains.jpg
--------------------------------------------------------------------------------
/examples/assets/images/office-big.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/office-big.jpg
--------------------------------------------------------------------------------
/examples/assets/images/office-small.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/office-small.jpg
--------------------------------------------------------------------------------
/examples/assets/images/responsive-obama-mobile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/responsive-obama-mobile.png
--------------------------------------------------------------------------------
/examples/assets/images/responsive-obama.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/responsive-obama.jpg
--------------------------------------------------------------------------------
/examples/assets/images/small.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/examples/assets/images/small.jpg
--------------------------------------------------------------------------------
/examples/assets/js/large.js:
--------------------------------------------------------------------------------
1 | window.onload = function(){
2 |
3 | alert("Big images downloaded! \n\nThis alert is executing from a script loaded from a media query specifying min-width 480px! \n\nRefresh again with a small width to see different script and images load.");
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/examples/assets/js/small.js:
--------------------------------------------------------------------------------
1 | window.onload = function(){
2 |
3 | alert("Small images downloaded! \n\nThis alert is executing from a script loaded from a media query specifying max-width 480px! \n\nRefresh again with a larger width to see different script and images load.");
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/examples/capturing-grumpycat/main.js:
--------------------------------------------------------------------------------
1 | // Main executable can now be found inline inside of the index.html file
2 | // of this example!
--------------------------------------------------------------------------------
/examples/capturing-grumpycat/performance-test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Performance tests of example headtag-capture example
4 |
5 |
6 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/examples/capturing-mediaquery/main.js:
--------------------------------------------------------------------------------
1 | // Main executable can now be found inline inside of the index.html file
2 | // of this example!
--------------------------------------------------------------------------------
/examples/capturing-mediaquery/performance-test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Performance tests of example headtag-capture example
4 |
5 |
6 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/examples/capturing-picturepolyfill/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
26 |
27 |
28 |
29 | Mobify.js Picturefill example
30 |
31 |
32 | Credit to scottjehl for his picturefill example
33 | This example has been forked and replicated using capturing to avoid the need for a <noscript> tag (view source to see for yourself).
34 | Open up the network tab of your web inspector to see that the img element does not have it's asset downloaded.
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/examples/capturing-picturepolyfill/main.js:
--------------------------------------------------------------------------------
1 | // Main executable can now be found inline inside of the index.html file
2 | // of this example!
--------------------------------------------------------------------------------
/examples/cssOptimize/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CSS Optimizer Example
6 |
31 |
32 |
33 |
34 |
35 |
36 | Styled!
37 |
38 | What an amazing example page. Watch out, my stylesheet will be loaded from elsewhere!
39 |
40 |
41 |
--------------------------------------------------------------------------------
/examples/jazzcat/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Mobify.js Jazzcat example
5 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
40 |
41 | Open your web inspector to see the changes made by Jazzcat
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/examples/jazzcat/performance-test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Performance tests of example headtag-capture example
4 |
5 |
6 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/examples/resizeImages-handle-service-failure/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Image Resizing Service Uh-Oh Tester
6 |
34 |
35 |
36 |
37 |
40 |
41 |
42 | Images!
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/examples/resizeImages-handle-service-failure/onerrortests.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | img element onerror behaviour classifier
6 |
7 |
8 |
17 |
23 |
24 |
25 |
http://garbage.domain.name.gfgrgrfgf/foo.jpg
26 |
27 |
28 |
29 |
30 |
/imagetests/textmime
31 |
32 |
33 |
34 |
35 |
/imagetests/emptyresponse
36 |
37 |
38 |
39 |
/imagetests/wrongmime
40 |
41 |
42 |
43 |
/imagetests/partialimage100b
44 |
45 |
46 |
47 |
/imagetests/partialimage1k
48 |
49 |
50 |
51 |
/imagetests/abortedimage
52 |
53 |
54 |
55 |
/imagetests/notFound
56 |
57 |
58 |
59 |
/imagetests/serverError
60 |
61 |
62 |
63 |
/imagetests/fakejpeg
64 |
65 |
66 |
--------------------------------------------------------------------------------
/examples/resizeImages-img-element/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Image Resizer with IMG elements
5 |
25 |
26 |
27 |
28 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/examples/unblockify/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
26 |
27 |
28 |
33 | Mobify.js unblockify example
34 |
35 |
36 |
37 |
38 |
39 |
40 | Scripts are now at the bottom of body!
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/mobify-custom.js.example:
--------------------------------------------------------------------------------
1 | var Mobify = require('./src/mobify-library');
2 |
3 | var capturing = window.Mobify && window.Mobify.capturing || false;
4 | if (capturing) {
5 | // Grab reference to a newly created document
6 | Mobify.Capture.initCapture(function(capture){
7 | // optimize scripts
8 | var capturedDoc = capture.capturedDoc;
9 | //var scripts = capturedDoc.querySelectorAll('script');
10 | //Mobify.Jazzcat.optimizeScripts(scripts);
11 | // optimize images
12 | var images = capturedDoc.querySelectorAll('img, picture');
13 | Mobify.ResizeImages.resize(images);
14 |
15 | capture.renderCapturedDoc();
16 | });
17 | } else {
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/mobifyjs:
--------------------------------------------------------------------------------
1 | .
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mobifyjs",
3 | "version": "2.0.16",
4 | "description": "Mobify.js is an open source library for improving responsive sites by providing responsive images, JS/CSS optimization, Adaptive Templating and more.",
5 | "author": "Mobify ",
6 | "devDependencies": {
7 | "express": "3.3.1",
8 | "grunt": "~0.4.0",
9 | "grunt-aws-s3": "^0.14.0",
10 | "grunt-browserify": "~1.3.1",
11 | "grunt-contrib-connect": "~0.1.0",
12 | "grunt-contrib-qunit": "~0.2.0",
13 | "grunt-contrib-uglify": "~0.2.0",
14 | "grunt-contrib-watch": "~0.2.x",
15 | "grunt-express": "~0.3.6",
16 | "grunt-jekyll": "~0.3.6",
17 | "grunt-release": "~0.6.0",
18 | "grunt-requirejs": "~0.4.0",
19 | "grunt-s3": "0.2.0-alpha.2",
20 | "grunt-saucelabs": "8.3.2",
21 | "hbs": "~2.3.0",
22 | "request": "~2.44.0"
23 | },
24 | "engine": ">= 0.10.1",
25 | "repository": {
26 | "type": "git",
27 | "url": "git@github.com:mobify/mobifyjs.git"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/performance/combined.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
23 | Combined scripts
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/performance/fixtures/jazzcatJSONResponse.html:
--------------------------------------------------------------------------------
1 | Jazzcat.load([
2 | {{#each scripts}}
3 | {"url":"{{{url}}}","status":"ready","statusCode":200,"headers":{"server":"GitHub.com","date":"Fri, 28 Jun 2013 20:21:47 GMT","content-type":"application/x-javascript","connection":"keep-alive","content-length":"13450","last-modified":"Wed, 10 Apr 2013 20:47:06 GMT","expires":"Fri, 28 Jun 2012 20:31:47 GMT","cache-control":"max-age=0","vary":"Accept-Encoding","accept-ranges":"bytes"},"body":{{&data}},"text":true},
4 | {{/each}}
5 | ]);
--------------------------------------------------------------------------------
/performance/fixtures/jazzcatJSResponse.html:
--------------------------------------------------------------------------------
1 | {{#each scripts}}
2 |
3 |
4 | {{&this}}
5 |
6 |
7 |
8 | {{/each}}
9 |
--------------------------------------------------------------------------------
/performance/fixtures/jazzcatRequest.json:
--------------------------------------------------------------------------------
1 | /* JSONP response for: http://underscorejs.org/underscore-min.js */
2 | Jazzcat.combo.load([
3 | {{#each scripts}}
4 | {"url":"{{{url}}}","status":"ready","statusCode":200,"headers":{"server":"GitHub.com","date":"Fri, 28 Jun 2013 20:21:47 GMT","content-type":"application/x-javascript","connection":"keep-alive","content-length":"13450","last-modified":"Wed, 10 Apr 2013 20:47:06 GMT","expires":"Fri, 28 Jun 2013 20:31:47 GMT","cache-control":"max-age=600","vary":"Accept-Encoding","accept-ranges":"bytes"},"body":"{{data}}","text":true},
5 | {{/each}}
6 | ]);
--------------------------------------------------------------------------------
/performance/fixtures/jazzcatRunner.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{> bootstrap}}
5 |
27 | Performance Runner for Jazzcat
28 |
29 |
30 | {{#each scripts}}
31 |
32 | {{/each}}
33 |
34 |
--------------------------------------------------------------------------------
/performance/resources/images/ajax-loader.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mobify/mobifyjs/4a4ff8a37ea69491fc2345b3c465e01257ae0612/performance/resources/images/ajax-loader.gif
--------------------------------------------------------------------------------
/performance/resources/samplescripts/jquery.icheck.min.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * iCheck v0.9.1 jQuery plugin, http://git.io/uhUPMA
3 | */
4 | (function(f){function C(a,c,d){var b=a[0],e=/er/.test(d)?k:/bl/.test(d)?u:j;active=d==E?{checked:b[j],disabled:b[u],indeterminate:"true"==a.attr(k)||"false"==a.attr(v)}:b[e];if(/^(ch|di|in)/.test(d)&&!active)p(a,e);else if(/^(un|en|de)/.test(d)&&active)w(a,e);else if(d==E)for(var e in active)active[e]?p(a,e,!0):w(a,e,!0);else if(!c||"toggle"==d){if(!c)a[r]("ifClicked");active?b[l]!==x&&w(a,e):p(a,e)}}function p(a,c,d){var b=a[0],e=a.parent(),g=c==j,H=c==k,m=H?v:g?I:"enabled",r=h(b,m+y(b[l])),L=h(b,
5 | c+y(b[l]));if(!0!==b[c]){if(!d&&c==j&&b[l]==x&&b.name){var p=a.closest("form"),s='input[name="'+b.name+'"]',s=p.length?p.find(s):f(s);s.each(function(){this!==b&&f.data(this,n)&&w(f(this),c)})}H?(b[c]=!0,b[j]&&w(a,j,"force")):(d||(b[c]=!0),g&&b[k]&&w(a,k,!1));J(a,g,c,d)}b[u]&&h(b,z,!0)&&e.find("."+F).css(z,"default");e[t](L||h(b,c));e[A](r||h(b,m)||"")}function w(a,c,d){var b=a[0],e=a.parent(),g=c==j,f=c==k,m=f?v:g?I:"enabled",n=h(b,m+y(b[l])),p=h(b,c+y(b[l]));if(!1!==b[c]){if(f||!d||"force"==d)b[c]=
6 | !1;J(a,g,m,d)}!b[u]&&h(b,z,!0)&&e.find("."+F).css(z,"pointer");e[A](p||h(b,c)||"");e[t](n||h(b,m))}function K(a,c){if(f.data(a,n)){var d=f(a);d.parent().html(d.attr("style",f.data(a,n).s||"")[r](c||""));d.off(".i").unwrap();f(D+'[for="'+a.id+'"]').add(d.closest(D)).off(".i")}}function h(a,c,d){if(f.data(a,n))return f.data(a,n).o[c+(d?"":"Class")]}function y(a){return a.charAt(0).toUpperCase()+a.slice(1)}function J(a,c,d,b){if(!b){if(c)a[r]("ifToggled");a[r]("ifChanged")[r]("if"+y(d))}}var n="iCheck",
7 | F=n+"-helper",x="radio",j="checked",I="un"+j,u="disabled",v="determinate",k="in"+v,E="update",l="type",t="addClass",A="removeClass",r="trigger",D="label",z="cursor",G=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini/i.test(navigator.userAgent);f.fn[n]=function(a,c){var d=":checkbox, :"+x,b=f(),e=function(a){a.each(function(){var a=f(this);b=a.is(d)?b.add(a):b.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),
8 | e(this),b.each(function(){"destroy"==a?K(this,"ifDestroyed"):C(f(this),!0,a);f.isFunction(c)&&c()});if("object"==typeof a||!a){var g=f.extend({checkedClass:j,disabledClass:u,indeterminateClass:k,labelHover:!0},a),h=g.handle,m=g.hoverClass||"hover",y=g.focusClass||"focus",v=g.activeClass||"active",z=!!g.labelHover,s=g.labelHoverClass||"hover",B=(""+g.increaseArea).replace("%","")|0;if("checkbox"==h||h==x)d=":"+h;-50>B&&(B=-50);e(this);return b.each(function(){K(this);var a=f(this),b=this,c=b.id,d=
9 | -B+"%",e=100+2*B+"%",e={position:"absolute",top:d,left:d,display:"block",width:e,height:e,margin:0,padding:0,background:"#fff",border:0,opacity:0},d=G?{position:"absolute",visibility:"hidden"}:B?e:{position:"absolute",opacity:0},h="checkbox"==b[l]?g.checkboxClass||"icheckbox":g.radioClass||"i"+x,k=f(D+'[for="'+c+'"]').add(a.closest(D)),q=a.wrap('
')[r]("ifCreated").parent().append(g.insert),e=f(' ').css(e).appendTo(q);a.data(n,{o:g,s:a.attr("style")}).css(d);
10 | g.inheritClass&&q[t](b.className);g.inheritID&&c&&q.attr("id",n+"-"+c);"static"==q.css("position")&&q.css("position","relative");C(a,!0,E);if(k.length)k.on("click.i mouseenter.i mouseleave.i touchbegin.i touchend.i",function(c){var d=c[l],e=f(this);if(!b[u])if("click"==d?C(a,!1,!0):z&&(/ve|nd/.test(d)?(q[A](m),e[A](s)):(q[t](m),e[t](s))),G)c.stopPropagation();else return!1});a.on("click.i focus.i blur.i keyup.i keydown.i keypress.i",function(c){var d=c[l];c=c.keyCode;if("click"==d)return!1;if("keydown"==
11 | d&&32==c)return b[l]==x&&b[j]||(b[j]?w(a,j):p(a,j)),!1;if("keyup"==d&&b[l]==x)!b[j]&&p(a,j);else if(/us|ur/.test(d))q["blur"==d?A:t](y)});e.on("click mousedown mouseup mouseover mouseout touchbegin.i touchend.i",function(d){var c=d[l],e=/wn|up/.test(c)?v:m;if(!b[u]){if("click"==c)C(a,!1,!0);else{if(/wn|er|in/.test(c))q[t](e);else q[A](e+" "+v);if(k.length&&z&&e==m)k[/ut|nd/.test(c)?A:t](s)}if(G)d.stopPropagation();else return!1}})})}return this}})(jQuery);
--------------------------------------------------------------------------------
/performance/separate.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 | Seperate scripts
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/config.js:
--------------------------------------------------------------------------------
1 | require.config({
2 | "wrap": true,
3 | "baseUrl": ".",
4 | "keepBuildDir": true,
5 | "paths": {
6 | "mobifyjs": ".",
7 | "mobifyjs/utils": "../bower_components/mobifyjs-utils/utils",
8 | "mobifyjs/jazzcat": "../bower_components/jazzcat-client/jazzcat",
9 | "mobifyjs/resizeImages": "../bower_components/imageresize-client/resizeImages"
10 | },
11 | });
12 |
--------------------------------------------------------------------------------
/src/mobify-library.js:
--------------------------------------------------------------------------------
1 | (function (root, factory) {
2 | if (typeof require === 'function' && typeof define === 'function' &&
3 | define.amd) {
4 | // AMD. Register as an anonymous module.
5 | require(["mobifyjs/utils", "mobifyjs/capture", "mobifyjs/resizeImages",
6 | "mobifyjs/jazzcat", "mobifyjs/unblockify",
7 | "mobifyjs/cssOptimize", "mobifyjs/external/picturefill"],
8 | factory,
9 | undefined, true);
10 | // relPath, forceSync
11 | } else if (typeof exports === 'object') {
12 | // Node. Does not work with strict CommonJS, but
13 | // only CommonJS-like environments that support module.exports,
14 | // like Node.
15 | var Utils = require('../bower_components/mobifyjs-utils/utils');
16 | var Capture = require('../bower_components/capturejs/src/capture');
17 | var ResizeImages = require('../bower_components/imageresize-client/resizeImages');
18 | var Jazzcat = require('../bower_components/jazzcat-client/jazzcat');
19 | var CssOptimize = require('../bower_components/css-optimize/src/cssOptimize');
20 | var Unblockify = require('./unblockify');
21 | require('./external/picturefill');
22 |
23 | module.exports = factory(Utils, Capture, ResizeImages, Jazzcat,
24 | Unblockify, CssOptimize);
25 | }
26 | }(this, function(Utils, Capture, ResizeImages, Jazzcat, Unblockify, CssOptimize) {
27 | var Mobify = window.Mobify = window.Mobify || {};
28 | Mobify.Utils = Utils;
29 | Mobify.Capture = Capture;
30 | Mobify.ResizeImages = ResizeImages;
31 | Mobify.Jazzcat = Jazzcat;
32 | Mobify.CssOptimize = CssOptimize;
33 | Mobify.Unblockify = Unblockify;
34 | Mobify.api = "2.0"; // v6 tag backwards compatibility change
35 | return Mobify;
36 |
37 | }));
38 |
--------------------------------------------------------------------------------
/src/unblockify.js:
--------------------------------------------------------------------------------
1 | (function (root, factory) {
2 | if (typeof define === 'function' && define.amd) {
3 | // AMD. Register as an anonymous module.
4 | define(['mobifyjs/utils', 'mobifyjs/capture'], factory);
5 | } else if (typeof exports === 'object') {
6 | // Node. Does not work with strict CommonJS, but
7 | // only CommonJS-like environments that support module.exports,
8 | // like Node.
9 | var Utils = require('../bower_components/mobifyjs-utils/utils.js');
10 | var Capture = require('../bower_components/capturejs/src/capture.js');
11 | module.exports = factory(Utils, Capture);
12 | } else {
13 | // Browser globals (root is window)
14 | root.Unblockify = factory(root.Utils, root.Capture);
15 | }
16 | }(this, function (Utils, Capture) {
17 |
18 | var Unblockify = {}
19 |
20 | // Moves all scripts to the end of body by overriding insertMobifyScripts
21 | Unblockify.moveScripts = function(scripts, doc) {
22 | // Remove elements from the document
23 | Utils.removeElements(scripts, doc);
24 |
25 | for (var i=0,ii=scripts.length; i
2 | (function(window, document, detector, mobifyjsUrl, main) {
3 |
4 | // Start Mobify object with initial timestamp when loaded.
5 | window.Mobify = {points: [+new Date]};
6 |
7 | // if mobify=(1|0) override is set in hash or cookie, force mobify on/off.
8 | var override = /((; )|#|&|^)mobify=(\d)/.exec(location.hash + '; ' + document.cookie);
9 | if (override && override[3]) {
10 | // if mobify=0, do not run mobify.
11 | if (!+override[3]) return;
12 | }
13 | // else do not run mobify if Mobify object exists, or detector fails.
14 | else if (!detector()) {
15 | return;
16 | }
17 |
18 | function attachScriptBeforeMobifyTag(script, id, classNames, src) {
19 | var mobifyTagScript = document.getElementsByTagName('script')[0];
20 | script.src = src;
21 | script.id = id;
22 | script.setAttribute("class", classNames);
23 | mobifyTagScript.parentNode.insertBefore(script, mobifyTagScript);
24 | }
25 |
26 | document.write('');
27 |
28 | // On next tick, load library and main executable
29 | setTimeout(function() {
30 | var Mobify = window.Mobify = window.Mobify || {};
31 | Mobify.capturing = true;
32 | var mobifyjsScript = document.createElement('script');
33 | var scriptClasses = "mobify";
34 | var errorHandler = function() {
35 | var now = new Date();
36 | // Set now to 5 minutes ahead
37 | now.setTime(now.getTime() + 300000);
38 | document.cookie = 'mobify=0' +
39 | '; expires=' + now.toGMTString() +
40 | '; path=/';
41 | // Reload the page (location.reload has problems in FF)
42 | window.location = window.location.href;
43 | };
44 | mobifyjsScript.onload = function(){
45 | if (main) {
46 | // if main is a path to a main file
47 | if (typeof main === 'string') {
48 | var mainScript = document.createElement('script');
49 | mainScript.onerror = errorHandler;
50 | attachScriptBeforeMobifyTag(mainScript, "main-executable", scriptClasses, mainUrl);
51 | } else {
52 | // Set main on Mobify object to be used later for re-insertion
53 | window.Mobify.mainExecutable = main.toString();
54 | main();
55 | }
56 | }
57 | };
58 | mobifyjsScript.onerror = errorHandler;
59 | attachScriptBeforeMobifyTag(mobifyjsScript, "mobify-js", scriptClasses, mobifyjsUrl);
60 |
61 | });
62 |
63 | })( window, document,
64 | // detector function
65 | function (){
66 | // We're enabled for:
67 | // - WebKit based browsers
68 | // - IE 10+
69 | // - FireFox 4+
70 | // - Opera 11+
71 | // - 3DS
72 | match = /webkit|(firefox)[\/\s](\d+)|(opera)[\s\S]*version[\/\s](\d+)|(trident)[\/\s](\d+)/i.exec(navigator.userAgent);
73 |
74 | if (!match) {
75 | return false;
76 | }
77 | // match[1] == Firefox
78 | if (match[1] && +match[2] < 4) {
79 | return false;
80 | }
81 | // match[3] == Opera
82 | if (match[3] && +match[4] < 11) {
83 | return false;
84 | }
85 | // match[5] == IE
86 | if (match[5] && +match[6] < 6) {
87 | return false;
88 | }
89 |
90 | return true;
91 | },
92 |
93 | {{#mobifyfull}}
94 | // Combine both library and main into one
95 | '{{this}}'
96 | {{/mobifyfull}}
97 | {{^mobifyfull}}
98 | // path to mobify.js: /mobifyjs/build/mobify.js',
99 | '{{library}}',
100 | // main function
101 | {{&main}}
102 | {{/mobifyfull}}
103 | );
104 |
105 |
--------------------------------------------------------------------------------
/tag/supportedBrowser.js:
--------------------------------------------------------------------------------
1 | /**
2 | supportedBrowser will return whether or not we are on a device
3 |
4 | @private
5 | @param {string} ua User agent to test
6 | @type {bool}
7 | */
8 | var supportedBrowser = function(ua) {
9 | // We're enabled for:
10 | // - WebKit based browsers
11 | // - IE 10+
12 | // - FireFox 4+
13 | // - Opera 11+
14 | var match = /webkit|(firefox)[\/\s](\d+)|(opera)[\s\S]*version[\/\s](\d+)|(trident)[\/\s](\d+)/i.exec(ua);
15 | if (!match) {
16 | return false;
17 | }
18 | // match[1] == Firefox
19 | if (match[1] && +match[2] < 4) {
20 | return false;
21 | }
22 | // match[3] == Opera
23 | if (match[3] && +match[4] < 11) {
24 | return false;
25 | }
26 | // match[5] == IE
27 | if (match[5] && +match[6] < 6) {
28 | return false;
29 | }
30 |
31 | return true;
32 | };
33 | window['supportedBrowser'] = supportedBrowser;
--------------------------------------------------------------------------------
/tag/v7.exposed.min.js:
--------------------------------------------------------------------------------
1 | (function(e,f){function m(a){if(a.mode){var b=g("mobify-mode");b&&a[b]||(b=a.mode(d.ua));return a[b]}return a}function n(){function a(a){e.addEventListener(a,function(){d[a]=+new Date},!1)}e.addEventListener&&(a("DOMContentLoaded"),a("load"))}function p(){var a=new Date;a.setTime(a.getTime()+3E5);f.cookie="mobify-path=; expires="+a.toGMTString()+"; path=/";e.location.reload()}function q(){k({src:"https://preview.mobify.com/v7/"})}function r(){return"true"==g("mobify-path")||/mobify-path=true/.test(e.location.hash)}
2 | function s(){return""===g("mobify-path")}function g(a){if(a=f.cookie.match(RegExp("(^|; )"+a+"((=([^;]*))|(; |$))")))return a[4]||""}function l(a){f.write('');setTimeout(function(){h.capturing=!0;a()},0)}function k(a,b){var c=f.getElementsByTagName("script")[0],d=f.createElement("script"),e;for(e in a)d[e]=a[e];b&&d.setAttribute("class",b);c.parentNode.insertBefore(d,c)}var h=e.Mobify={},d=h.Tag={},c={};d.Private=c;h.points=[+new Date];h.tagVersion=[7,0];d.ua=e.navigator.userAgent;
3 | c.previewUrl="https://preview.mobify.com/v7/";c.loadScript=k;c.startCapture=l;c.getCookie=g;c.isDisabled=s;c.isPreview=r;c.loadPreview=q;c.disableTag=p;c.collectTiming=n;d.getOptions=m;d.init=function(a){d.options=a;if(!s())if(n(),!a.skipPreview&&r())l(q);else{var b=m(a);if(b){var c=function(){b.post&&b.post()};a=function(){b.pre&&b.pre();k({id:"mobify-js",src:b.url,onerror:p,onload:c},"mobify")};!1===b.capture?a():l(a)}}}})(window,document);
4 |
--------------------------------------------------------------------------------
/tag/v7.min.js:
--------------------------------------------------------------------------------
1 | (function(e,f){function h(a){if(a.mode){var b=g("mobify-mode");b&&a[b]||(b=a.mode(c.ua));return a[b]}return a}function m(){function a(a){e.addEventListener(a,function(){c[a]=+new Date},!1)}e.addEventListener&&(a("DOMContentLoaded"),a("load"))}function n(){if(!f.visibilityState||!f.hidden){var a=new Date;a.setTime(a.getTime()+3E5);f.cookie="mobify-path=; expires="+a.toGMTString()+"; path=/";e.location.reload()}}function p(){k({src:"https://preview.mobify.com/v7/"})}function g(a){if(a=f.cookie.match(new RegExp("(^|; )"+
2 | a+"((=([^;]*))|(; |$))")))return a[4]||""}function l(a){f.write('');setTimeout(function(){d.capturing=!0;a()},0)}function k(a,b){var e=f.getElementsByTagName("script")[0],c=f.createElement("script"),d;for(d in a)c[d]=a[d];b&&c.setAttribute("class",b);e.parentNode.insertBefore(c,e)}var d=e.Mobify={},c=d.Tag={};d.points=[+new Date];d.tagVersion=[7,0];c.ua=e.navigator.userAgent;c.getOptions=h;c.init=function(a){c.options=a;if(""!==g("mobify-path"))if(m(),a.skipPreview||
3 | "true"!=g("mobify-path")&&!/mobify-path=true/.test(e.location.hash)){var b=h(a);if(b){var d=function(){b.post&&b.post()};a=function(){b.pre&&b.pre();k({id:"mobify-js",src:b.url,onerror:n,onload:d},"mobify")};!1===b.capture?a():l(a)}}else l(p)}})(window,document);
4 |
--------------------------------------------------------------------------------
/tests/fixtures/blank-example.html:
--------------------------------------------------------------------------------
1 | Blank
2 |
--------------------------------------------------------------------------------
/tests/fixtures/meta.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/tests/fixtures/mobify-library-example.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/tests/fixtures/plaintext-above-head-example.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Plaintext example page!
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tests/fixtures/plaintext-comment-example.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Plaintext example page!
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/tests/fixtures/plaintext-display-none-body.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
12 | Plaintext example page!
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/tests/fixtures/plaintext-example.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
12 | Plaintext example page!
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/tests/fixtures/plaintext-malformed-markup-example.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Plaintext example page!
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/tests/fixtures/plaintext-no-end-head-example.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 | Plaintext example page!
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/tests/fixtures/plaintext-restore-example.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 | Plaintext example page!
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/tests/fixtures/plaintext-sibling-forms.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/tests/fixtures/split.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
33 |
34 |
35 |
36 | If things worked, you should "Complete!" below:
37 |
38 | Complete! h1>
39 |
40 |
41 |
--------------------------------------------------------------------------------
/tests/fixtures/tag.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Mobify tag Tests
10 |
11 | Content
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/always-run.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
15 |
16 |
17 | Mobify tag Tests
18 |
19 | Content
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/desktop.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
18 |
19 |
20 | Mobify tag Tests
21 |
22 | Content
23 |
24 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/desktop.js:
--------------------------------------------------------------------------------
1 | window.mobifyJSLoaded = true;
2 | window.mobifyjsFileName = "/tests/fixtures/tag/desktop.js";
3 |
4 | Assert.ok(true, "desktop.js was loaded.");
5 | Assert.ready();
--------------------------------------------------------------------------------
/tests/fixtures/tag/disabled.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
15 |
16 |
17 | Mobify tag Tests
18 |
19 | Content
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/dont-load.js:
--------------------------------------------------------------------------------
1 | window.mobifyJSLoaded = true;
2 | window.mobifyjsFileName = "/tests/fixtures/tag/dont-load.js";
3 |
4 | Assert.ok(false, "dont-load.js was loaded.");
5 | Assert.ready();
--------------------------------------------------------------------------------
/tests/fixtures/tag/failed-load-tag.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
14 |
15 |
16 | Mobify tag Tests
17 |
18 | Content
19 |
20 |
24 |
25 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/mobile.js:
--------------------------------------------------------------------------------
1 | window.mobifyJSLoaded = true;
2 | window.mobifyjsFileName = "/tests/fixtures/tag/mobile.js";
3 |
4 | Assert.ok(true, "mobile.js was loaded.");
5 | Assert.ready();
--------------------------------------------------------------------------------
/tests/fixtures/tag/no-run.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Mobify tag Tests
10 |
11 | Content
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/onerror.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 |
12 | Mobify tag Tests
13 |
14 | Content
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/postload.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
13 |
14 |
15 |
16 |
26 |
27 |
28 | Mobify tag Tests
29 |
30 | Content
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/preload.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
24 |
25 |
26 | Mobify tag Tests
27 |
28 | Content
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/preview.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
15 |
16 | Mobify tag Tests
17 |
18 | Content
19 |
20 |
23 |
24 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/preview.js:
--------------------------------------------------------------------------------
1 | window.mobifyJSLoaded = true;
2 | window.mobifyjsFileName = "/tests/fixtures/tag/preview.js";
3 |
4 | Assert.ok(true, "preview.js Loaded");
5 | Assert.ready();
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
15 | Title of Page
16 |
17 |
18 | Mobify tag Tests
19 |
20 | Content
21 |
22 | First Paragraph
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-0/README.md:
--------------------------------------------------------------------------------
1 | Scaffold
2 | ----------------------
3 |
4 | /
5 | src/
6 | tmpl/
7 | (templates)
8 | mobify.konf
9 | project.json
10 | style.css
11 | README.md
12 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-0/bld/style.css:
--------------------------------------------------------------------------------
1 | html{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{font:400 1em "Helvetica Neue",sans-serif;color:#15191A;background:#eaecec;text-align:center;margin:0;padding:10px 40px;width:240px}h1{font-size:1.6em}h2{font-size:1em;font-weight:400}.extract{font-weight:700;padding:10px;margin:20px;background:#fff;border:solid 1px #d7dcdd;border-radius:3px;box-shadow:0 2px 4px #d7dcdd}
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-0/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "project1-0",
3 | "api": "1.0",
4 | "source_directory": "src",
5 | "build_directory": "bld",
6 | "plugins": [],
7 | "exclude": [
8 | "*.tmpl"
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-0/src/mobify.konf:
--------------------------------------------------------------------------------
1 | {>"/base/lib/base_konf.konf"/}
2 | {
4 |
5 |
Welcome to your first Mobify.js Mobile Page
6 | As an initial example of content selection, we've selected the title of your site and placed it in _header.tmpl:
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-0/src/tmpl/home.tmpl:
--------------------------------------------------------------------------------
1 | {>base/}
2 |
3 | {We've also extracted the first paragraph from your site and placed it in home.tmpl:
5 |
8 |
9 |
10 |
14 | {/content}
15 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
15 |
16 | Title of Page
17 |
18 |
19 | Mobify tag Tests
20 |
21 | Content
22 |
23 | First Paragraph
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-1/README.md:
--------------------------------------------------------------------------------
1 | Scaffold
2 | ----------------------
3 |
4 | /
5 | src/
6 | tmpl/
7 | (templates)
8 | mobify.konf
9 | project.json
10 | style.css
11 | README.md
12 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-1/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "project1-1",
3 | "api": "1.1",
4 | "source_directory": "src",
5 | "build_directory": "bld",
6 | "plugins": [],
7 | "exclude": [
8 | "*.tmpl"
9 | ]
10 | }
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-1/src/mobify.konf:
--------------------------------------------------------------------------------
1 | {>"/base/lib/base_konf.konf"/}
2 | {
4 |
5 |
Welcome to your first Mobify.js Mobile Page
6 | As an initial example of content selection, we've selected the title of your site and placed it in _header.tmpl:
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/project1-1/src/tmpl/home.tmpl:
--------------------------------------------------------------------------------
1 | {>base/}
2 |
3 | {We've also extracted the first paragraph from your site and placed it in home.tmpl:
5 |
8 |
9 |
10 |
14 | {/content}
15 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/project2-0.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
33 |
34 | Title of Page
35 |
36 |
37 | Mobify tag Tests
38 |
39 | Content
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/single-mode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 | Mobify tag Tests
14 |
15 | Content
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/skip-preview.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 |
19 |
20 | Mobify tag Tests
21 |
22 | Content
23 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/tests/fixtures/tag/useragent.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
24 |
25 |
26 | Mobify tag Tests
27 |
28 | Content
29 |
30 |
--------------------------------------------------------------------------------
/tests/fixtures/unblock-example.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
13 | Unblock fixture page!
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/tests/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | mobify.js tests
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
31 |
32 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/tests/resources/smallscript.js:
--------------------------------------------------------------------------------
1 | verify.push(4);
2 |
--------------------------------------------------------------------------------
/tests/supportedBrowser-tests.js:
--------------------------------------------------------------------------------
1 | module("SupportedBrowser");
2 |
3 | test("Ensure Supported Browser function works", function() {
4 | var ua = "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko";
5 | equal(window.supportedBrowser(ua), true, "Correctly detects browser support for IE11");
6 |
7 | var ua = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)";
8 | equal(window.supportedBrowser(ua), true, "Correctly detects browser support for IE10");
9 |
10 | var ua = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)";
11 | equal(window.supportedBrowser(ua), false, "Correctly detects browser support for IE9");
12 |
13 | var ua = "Mozilla/45.0 (compatible; MSIE 6.0; Windows NT 5.1)";
14 | equal(window.supportedBrowser(ua), false, "Correctly detects browser support for IE6");
15 |
16 | // Firefox browsers
17 | var ua = "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100915 Gentoo Firefox/3.6.9";
18 | equal(window.supportedBrowser(ua), false, "Correctly detects browser support for FF3.6");
19 |
20 | var ua = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0";
21 | equal(window.supportedBrowser(ua), true, "Correctly detects browser support for FF25");
22 |
23 | var ua = "Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9.1.3) Gecko/20091020 Ubuntu/10.04 (lucid) Firefox/4.0.1";
24 | equal(window.supportedBrowser(ua), true, "Correctly detects browser support for Firefox 4.0.1");
25 |
26 | var ua = "Mozilla/6.0 (Windows NT 6.2; WOW64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1";
27 | equal(window.supportedBrowser(ua), true, "Correctly detects browser support for Firefox 16.0.1");
28 |
29 | // iOS browsers
30 | var ua = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7";
31 | equal(window.supportedBrowser(ua), true, "Correctly detects browser support for iPhone");
32 |
33 | // Chrome browsers
34 | var ua = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 Safari/537.15";
35 | equal(window.supportedBrowser(ua), true, "Correctly detects browser support for Chrome 24");
36 |
37 | // Opera browsers
38 | var ua = "Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02";
39 | equal(window.supportedBrowser(ua), true, "Correctly detects browser support for Opera 12");
40 |
41 | var ua = "Opera/9.80 (X11; Linux x86_64; U; Ubuntu/10.10 (maverick); pl) Presto/2.7.62 Version/11.01";
42 | equal(window.supportedBrowser(ua), true, "Correctly detects browser support for Opera 11");
43 |
44 | var ua = "Opera/9.80 (Windows NT 6.1; U; pl) Presto/2.6.31 Version/10.70";
45 | equal(window.supportedBrowser(ua), false, "Correctly detects browser support for Opera 10");
46 | });
--------------------------------------------------------------------------------
/tests/tag-old-browser.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Mobify.js Tag Tests for Old Browsers
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/tests/unblockify-tests.js:
--------------------------------------------------------------------------------
1 | require(["mobifyjs/utils", "mobifyjs/capture", "mobifyjs/unblockify"], function(Utils, Capture, Unblockify) {
2 | window.Unblockify = Unblockify;
3 | QUnit.start();
4 |
5 | module("Unblockify");
6 | asyncTest("moveScripts", function(){
7 | var iframe = $("