diff --git a/Gruntfile.js b/Gruntfile.js index 7f81986a..b6488cfa 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -56,6 +56,32 @@ module.exports = function(grunt) { files: { 'dest/respond.matchmedia.addListener.min.js': ['src/matchmedia.polyfill.js', 'src/matchmedia.addListener.js', 'src/respond.js'] } + }, + crossDomain: { + options: { + preserveComments: 'some' + }, + files: { + 'dest/cross-domain/respond.proxy.min.js': ['cross-domain/respond.proxy.js'] + } + } + }, + htmlmin: { + crossDomain: { + options: { + collapseWhitespace: true, + conservativeCollapse: true, + minifyJS: true + }, + files: { + 'dest/cross-domain/respond-proxy.min.html': 'cross-domain/respond-proxy.html' + } + } + }, + copy: { + crossDomain: { + src: 'cross-domain/respond.proxy.gif', + dest: 'dest/' } }, jshint: { @@ -85,8 +111,10 @@ module.exports = function(grunt) { grunt.loadNpmTasks( 'grunt-contrib-jshint' ); grunt.loadNpmTasks( 'grunt-contrib-uglify' ); + grunt.loadNpmTasks( 'grunt-contrib-htmlmin' ); + grunt.loadNpmTasks( 'grunt-contrib-copy' ); // Default task. - grunt.registerTask('default', ['jshint', 'uglify']); + grunt.registerTask('default', ['jshint', 'uglify', 'htmlmin', 'copy']); }; diff --git a/dest/cross-domain/respond-proxy.min.html b/dest/cross-domain/respond-proxy.min.html new file mode 100644 index 00000000..894f2fd2 --- /dev/null +++ b/dest/cross-domain/respond-proxy.min.html @@ -0,0 +1 @@ + Respond JS Proxy \ No newline at end of file diff --git a/dest/cross-domain/respond.proxy.gif b/dest/cross-domain/respond.proxy.gif new file mode 100644 index 00000000..ced1c053 Binary files /dev/null and b/dest/cross-domain/respond.proxy.gif differ diff --git a/dest/cross-domain/respond.proxy.min.js b/dest/cross-domain/respond.proxy.min.js new file mode 100644 index 00000000..0f3c0844 --- /dev/null +++ b/dest/cross-domain/respond.proxy.min.js @@ -0,0 +1,2 @@ +/*! Respond.js: min/max-width media query polyfill. Remote proxy (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ +!function(a,b){function c(b){return a.encodeURIComponent(b)}function d(d,f){function g(){var b;try{b=k.contentWindow.name}catch(c){}b?(k.src="about:blank",k.parentNode.removeChild(k),k=null,l&&(l=null,a.CollectGarbage&&a.CollectGarbage()),f(b)):a.setTimeout(g,100)}var k,l;"ActiveXObject"in a?(l=new ActiveXObject("htmlfile"),l.open(),l.write(''),l.close(),k=l.getElementById("x")):(k=b.createElement("iframe"),k.style.cssText="position:absolute;top:-99em",h.insertBefore(k,h.firstElementChild||h.firstChild)),k.src=e(i)+"?url="+c(j)+"&css="+c(e(d)),a.setTimeout(g,500)}function e(a){return k&&-1===a.indexOf(k.href)&&(bref=/\/$/.test(k.href)?k.href:k.href+"/",a=bref+a),a}function f(){if(~!j.indexOf(location.host)){var a=b.createElement("div");a.innerHTML='',h.insertBefore(a,h.firstElementChild||h.firstChild),j=a.firstChild.href,a.parentNode.removeChild(a),a=null}}function g(){for(var a=b.getElementsByTagName("link"),c=0,e=a.length;e>c;c++){var f=a[c],g=a[c].href,h=/^([a-zA-Z:]*\/\/(www\.)?)/.test(g),i=k&&!h||h;f.rel.indexOf("stylesheet")>=0&&i&&!function(a){d(g,function(b){a.styleSheet.rawCssText=b,respond.update()})}(f)}}var h=b.documentElement,i=b.getElementById("respond-proxy").href,j=(b.getElementById("respond-redirect")||location).href,k=b.getElementsByTagName("base")[0];respond.mediaQueriesSupported||(f(),g())}(window,document); \ No newline at end of file diff --git a/package.json b/package.json index 9d7f5b21..6ad9866a 100644 --- a/package.json +++ b/package.json @@ -1,33 +1,34 @@ { - "name": "Respond.js", - "description": "min/max-width media query polyfill", + "name": "Respond.js", + "description": "min/max-width media query polyfill", "version": "1.4.2", - "homepage": "https://github.com/scottjehl/Respond", + "homepage": "https://github.com/scottjehl/Respond", "homepageShortened": "http://j.mp/respondjs", - "author": { - "name": "Scott Jehl", - "email": "scott@filamentgroup.com", - "url": "http://filamentgroup.com" - }, - "repository": { - "type": "git", - "url": "https://github.com/scottjehl/Respond.git" - }, - "bugs": { - "url": "https://github.com/scottjehl/Respond/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT" - } - ], - "devDependencies": { - "grunt-cli":"~0.1", - "grunt": "~0.4.0", - "grunt-contrib-jshint": "~0.2.0", - "grunt-contrib-qunit": "~0.3.0", - "grunt-contrib-uglify": "0.2.7" - } - + "author": { + "name": "Scott Jehl", + "email": "scott@filamentgroup.com", + "url": "http://filamentgroup.com" + }, + "repository": { + "type": "git", + "url": "https://github.com/scottjehl/Respond.git" + }, + "bugs": { + "url": "https://github.com/scottjehl/Respond/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT" + } + ], + "devDependencies": { + "grunt": "~0.4.0", + "grunt-cli": "~0.1", + "grunt-contrib-copy": "^0.5.0", + "grunt-contrib-htmlmin": "^0.3.0", + "grunt-contrib-jshint": "~0.5.0", + "grunt-contrib-qunit": "~0.3.0", + "grunt-contrib-uglify": "0.2.7" + } }