diff --git a/nginx.conf b/nginx.conf index 612029a2..a9938f1e 100644 --- a/nginx.conf +++ b/nginx.conf @@ -54,6 +54,8 @@ http { location / { try_files $uri $uri/ /index.html =404; } + location /iframe.html { + try_files $uri $uri/ /iframe.html =404; + } } } - diff --git a/src/iframe.html b/src/iframe.html new file mode 100644 index 00000000..7fc4a489 --- /dev/null +++ b/src/iframe.html @@ -0,0 +1,9 @@ + + + + + + + This is the magical iframe + + diff --git a/src/xdLocalStoragePostMessageApi.min.js b/src/xdLocalStoragePostMessageApi.min.js new file mode 100644 index 00000000..b1db6fa7 --- /dev/null +++ b/src/xdLocalStoragePostMessageApi.min.js @@ -0,0 +1 @@ +"use strict";window.XdUtils=window.XdUtils||function(){function a(a,b){var c,d=b||{};for(c in a)a.hasOwnProperty(c)&&(d[c]=a[c]);return d}return{extend:a}}(),function(){function a(a,b){var c=XdUtils.extend(b,l);c.id=a,parent.postMessage(JSON.stringify(c),"*")}function b(b,c){a(b,{key:c,value:localStorage.getItem(c)})}function c(b,c,d){localStorage.setItem(c,d),a(b,{success:localStorage.getItem(c)===d})}function d(b,c){localStorage.removeItem(c),a(b,{})}function e(b,c){a(b,{key:localStorage.key(c)})}function f(b){a(b,{size:JSON.stringify(localStorage).length})}function g(b){a(b,{length:localStorage.length})}function h(b){localStorage.clear(),a(b,{})}function i(a){var i;try{i=JSON.parse(a.data)}catch(a){}i&&i.namespace===k&&("set"===i.action?c(i.id,i.key,i.value):"get"===i.action?b(i.id,i.key):"remove"===i.action?d(i.id,i.key):"key"===i.action?e(i.id,i.key):"size"===i.action?f(i.id):"length"===i.action?g(i.id):"clear"===i.action&&h(i.id))}function j(){var a={namespace:k,id:"iframe-ready"};parent.postMessage(JSON.stringify(a),"*")}var k="cross-domain-local-message",l={namespace:k};window.addEventListener?window.addEventListener("message",i,!1):window.attachEvent("onmessage",i),j()}(); \ No newline at end of file diff --git a/webpack.config.dev.js b/webpack.config.dev.js index bd0625ae..ff4bc29b 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -32,7 +32,7 @@ module.exports = { publicPath: '/' }, plugins: [ - new CopyWebpackPlugin(['src/.htaccess']), + new CopyWebpackPlugin(['src/.htaccess', 'src/iframe.html', 'src/xdLocalStoragePostMessageApi.min.js']), // new webpack.optimize.CommonsChunkPlugin({ // name: 'lib', // filename: 'lib.js' diff --git a/webpack.config.prod.js b/webpack.config.prod.js index 5ad9d7e7..6d95e652 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -30,7 +30,7 @@ module.exports = { } }, plugins: [ - new CopyWebpackPlugin(['src/.htaccess', { from: 'src/schemas', to: 'schemas' }, {from: 'src/images/logo/*', flatten: true, to: ''}]), + new CopyWebpackPlugin(['src/.htaccess', { from: 'src/schemas', to: 'schemas' }, {from: 'src/images/logo/*', flatten: true, to: ''}, 'src/iframe.html', 'src/xdLocalStoragePostMessageApi.min.js']), // new webpack.optimize.CommonsChunkPlugin({ // name: 'lib', // filename: 'lib.[chunkhash:6].js'