Socket
Socket
Sign inDemoInstall

micro-app

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-app - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

4

demo/micro-app.min.js
/*!
* @ProjectName micro-app
* @Version 0.0.6
* @Version 0.0.7
* @Author lixinliang
* @Update Mon Aug 22 2016 14:06:20 GMT+0800 (CST)
* @Update Mon Aug 22 2016 15:29:49 GMT+0800 (CST)
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microApp=t():e.microApp=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var i=n(1),r=i.userAgent,a=document.querySelector("script[micro-app]");if(!a){var o,c=n(1),s=c.show,l=c.createElement;a=(o=l("<script micro-app>"),s).call(o)}r.is.ios?r.is.safari?n(2).main(a):navigator.standalone?n(7).standalone(a):n(1).compatible(a):n(1).compatible(a),e.exports=a},function(e,t){"use strict";function n(){var e=[];for(var t in o){var n=o[t];null!==n&&e.push(t+"="+n)}location.hash=encodeURIComponent(e.join("&"))}var i=document,r=i.head;t.camel2hyphen=function(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})},t.compatible=function(e){["hash","filter"].forEach(function(t){e[t]=function(){return console.warn('micro-app: "'+t+'" is an empty function.'),this}})};var a=i.createElement("div");t.createElement=function(e){return a.innerHTML=e,a.firstElementChild},t.defineStaticProperty=function(e,t){return Object.defineProperty(this,e,{value:t,writable:!1,enumerable:!1,configurable:!1}),this},t.hashListener=function(e){function t(e){var t=e.indexOf("#");if(t>-1&&t<e.length-1){var i=e.substring(t+1);n.test(i)||console.warn('micro-app: "location.hash" is in use to save the params.')}}var n=new RegExp("(^|&)("+e.join("|")+")"+encodeURIComponent("="));window.addEventListener("hashchange",function(e){t(e.newURL)}),t(location.href)};var o={};if(location.hash){var c=decodeURIComponent(location.hash.substring(1));c.split("&").forEach(function(e){var t=e.split("="),n=t[0],i=t[1];void 0===i&&(i=""),o[n]=i})}t.hash=function(e,t){return void 0===e?o:void 0===t?o[e]:(o[e]=t,n(),this)},t.hide=function(){return r.removeChild(this),this},t.NaF=function(e){return"function"==typeof e?NaF(e()):e},t.parseArgument=function(e){var t=/\(/.test(e),n=/\)/.test(e);if(!t&&!n)return[e,[]];try{if(!t)throw new SyntaxError('[micro-app] Missing "(" before argument list.');if(!n)throw new SyntaxError('[micro-app] Missing ")" after argument list.');if(!/\)$/.test(e))throw new SyntaxError('[micro-app] Unexpected end of "'+e.match(/.*(\).*$)/)[1]+'".');var i=e.match(/(.*?)\((.*)\)$/),r=i[1],a=i[2];return[r,JSON.parse("["+a+"]")]}catch(o){return setTimeout(function(){throw o},0),[""]}},t.parseFilter=function(e){return e?e.substring(1).split("|"):[]},t.parseUrl=function(e){var t=i.createElement("a");return t.href=e,t};var s=Element.prototype,l=s.setAttribute,u=s.removeAttribute;t.setAttribute=function(e,t){return null===t?u.call(this,e):l.call(this,e,t),this},t.show=function(){return r.appendChild(this),this};var p=navigator.userAgent;t.userAgent={is:{ios:/\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(p),safari:/\bversion\/([0-9.]+(?: beta)?)(?: mobile(?:\/[a-z0-9]+)?)? safari\//i.test(p)},device:/iPad/i.test(p)?"pad":"phone",os:parseInt((p.match(/\bcpu(?: iphone)? os /i.test(p)?/\bcpu(?: iphone)? os ([0-9._]+)/i:/\biph os ([0-9_]+)/i)||[,0])[1])>6?7:6}},function(e,t,n){"use strict";var i=n(1),r=n(3),a=n(4),o=n(5),c=n(6);t.main=function(e){function t(t,n){var r=t instanceof Array?t.slice(0):null===t?[]:[t],a=this.result;this.result=(0,c.createMultiElement)(r,a,{code:this.code,attribute:"href",success:function(e){var t=this,n=!1;(0,i.parseFilter)((0,i.parseUrl)(e).hash).forEach(function(e){if(!n&&""!==e){var r=(0,i.parseArgument)(e),a=r[0],o=r[1],c=l[a];"function"==typeof c&&(n=(0,i.NaF)(c.apply(t,o))===!1)}})}}),i.setAttribute.call(e,this.name,t instanceof Array?s:t)}var n,s=Object.prototype.toString.call([]),l={};(0,i.hashListener)(["href"]),i.defineStaticProperty.call(e,"filter",function(e,t){if(arguments.length<2)throw new TypeError("[micro-app] 2 arguments required, but only "+arguments.length+" present.");if("string"!=typeof e)throw new TypeError("[micro-app] A valid filter name should be string.");if(!e)throw new TypeError("[micro-app] A valid filter name should not be empty string.");if(/[\||\(|\)]/.test(e))throw new TypeError('[micro-app] "'+e+'" is not a valid filter name, "'+e.match(/[\||\(|\)]/)[0]+'" is not allowed.');if("function"!=typeof t)throw new TypeError("[micro-app] The second argument must be a function.");return l[e]=t,this}),e.filter("precomposed",function(){this.rel="apple-touch-icon-precomposed"}),e.filter("autosize",function(){var e="apple-touch-startup-image"===this.getAttribute("rel")?"splash":"icon",t=(0,a.autosize)(e);if(t)for(var n in t)this.setAttribute(n,t[n])});var u=(0,i.createElement)('<meta name="apple-mobile-web-app-capable" content="yes">'),p=(0,i.createElement)('<meta name="apple-mobile-web-app-status-bar-style">'),h=(0,i.createElement)('<meta name="apple-mobile-web-app-title">');(n=(n=(n=(n=(n=(n=(n=(n=(n=o.defineProperty.call(e,{name:"capable",onChange:function(t,n){i.setAttribute.call(e,this.name,t),null===t&&i.hide.call(u),null===n&&i.show.call(u)}}),o.defineProperty).call(n,{name:"statusBarStyle",hyphenName:(0,i.camel2hyphen)("statusBarStyle"),onChange:function(t,n){i.setAttribute.call(e,this.hyphenName,t),i.setAttribute.call(p,"content",t),null===t&&i.hide.call(p),null===n&&i.show.call(p)}}),o.defineProperty).call(n,{name:"title",onChange:function(t,n){i.setAttribute.call(e,this.name,t),i.setAttribute.call(h,"content",t),null===t&&i.hide.call(h),null===n&&i.show.call(h)}}),o.defineProperty).call(n,{result:[],name:"icon",code:'<link rel="apple-touch-icon">',onChange:t}),o.defineProperty).call(n,{result:[],name:"splash",code:'<link rel="apple-touch-startup-image">',onChange:t}),o.defineProperty).call(n,{name:"href",onChange:function(t,n){i.setAttribute.call(e,this.name,t),(0,i.hash)(this.name,t)}}),r.override).call(n,"getAttribute",function(e,t){var n=t[0];if(n in o.defineProperty)return e.stopPropagation(),this[n]}),r.override).call(n,"setAttribute",function(e,t){var n=t[0],i=t[1];if(n in o.defineProperty)return e.stopPropagation(),this[n]=i}),r.override).call(n,"removeAttribute",function(e,t){var n=t[0];if(n in o.defineProperty)return e.stopPropagation(),this[n]=null}),i.defineStaticProperty).call(n,"hash",i.hash)}},function(e,t,n){"use strict";var i=n(1);t.override=function(e,t){var n=this[e];return"function"==typeof n&&i.defineStaticProperty.call(this,e,function(){var e=!0,i=t.call(this,{stopPropagation:function(){e=!1}},arguments);return e?n.apply(this,arguments):i}),this}},function(e,t,n){"use strict";var i=n(1),r=i.userAgent.device,a=i.userAgent.os,o=devicePixelRatio>1?1:0,c={phone:{6:{0:"57x57",1:"114x114"},7:{0:"60x60",1:"120x120"}},pad:{6:{0:"72x72",1:"144x144"},7:{0:"76x76",1:"152x152"}}},s={},l="device-width",u="device-height";"phone"==r?(s[l]=320,s[u]=480,[{width:320,height:568},{width:375,height:667},{width:414,height:736}].forEach(function(e){matchMedia("("+l+":"+e.width+"px)and("+u+":"+e.height+"px)").matches&&(s[l]=e.width,s[u]=e.height)}),s[l]+="px",s[u]+="px"):(s[l]="768px",s[u]="1024px"),s["-webkit-device-pixel-ratio"]=devicePixelRatio,t.autosize=function(e){if("icon"==e){var t=c[r][a][o];return{sizes:t}}if("splash"==e){var n=[];for(var i in s)n.push("("+i+":"+s[i]+")");"pad"!=r&&3!=devicePixelRatio||(matchMedia("(orientation:landscape)").matches?n.push("(orientation:landscape)"):n.push("(orientation:portrait)"));var l=n.join("and");return{media:l}}}},function(e,t,n){"use strict";var i=n(1);t.defineProperty=function r(e){var t=e.name,n=e.hyphenName||t,a=void 0;void 0===e.value?a=e.value=this.getAttribute(n):this.setAttribute(n,a=e.value),null!==a&&e.onChange(a,null);var o={get:function(){return e.value},set:function(t){return t=(0,i.NaF)(t),t!==e.value&&e.onChange(t,e.value),e.value=t},enumerable:!1};return Object.defineProperty(this,t,o),t!=n?(Object.defineProperty(this,n,o),r[t]=r[n]=!0,this):(r[t]=!0,this)}},function(e,t,n){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},r=n(1),a=Element.prototype.getAttribute;t.createMultiElement=function(e,t,n){var o=[],c=n.attribute;t.forEach(function(e){r.hide.call(e)});for(var s=e.length,l=0;l<s;l++){var u=(0,r.NaF)(e[l]);if(null===u);else{var p,h=(p=(0,r.createElement)(n.code),r.show).call(p);if("object"==("undefined"==typeof u?"undefined":i(u))){r.setAttribute.call(h,c,void 0);for(var f in u)r.setAttribute.call(h,f,(0,r.NaF)(u[f]))}else r.setAttribute.call(h,c,u);var d=a.call(h,c);r.setAttribute.call(h,"original-"+c,d),d.indexOf("#")>-1&&r.setAttribute.call(h,c,d.split("#")[0]),n.success&&n.success.call(h,d),o.push(h)}}return o}},function(e,t,n){"use strict";var i=n(1);t.standalone=function(){var e=(0,i.hash)("href");if(e){var t=document.createEvent("CustomEvent");t.initEvent("redirect",!1,!0),window.dispatchEvent(t)&&location.replace(e)}}}])});
/*!
* @ProjectName micro-app
* @Version 0.0.6
* @Version 0.0.7
* @Author lixinliang
* @Update Mon Aug 22 2016 14:06:20 GMT+0800 (CST)
* @Update Mon Aug 22 2016 15:29:49 GMT+0800 (CST)
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.microApp=t():e.microApp=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var i=n(1),r=i.userAgent,a=document.querySelector("script[micro-app]");if(!a){var o,c=n(1),s=c.show,l=c.createElement;a=(o=l("<script micro-app>"),s).call(o)}r.is.ios?r.is.safari?n(2).main(a):navigator.standalone?n(7).standalone(a):n(1).compatible(a):n(1).compatible(a),e.exports=a},function(e,t){"use strict";function n(){var e=[];for(var t in o){var n=o[t];null!==n&&e.push(t+"="+n)}location.hash=encodeURIComponent(e.join("&"))}var i=document,r=i.head;t.camel2hyphen=function(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()})},t.compatible=function(e){["hash","filter"].forEach(function(t){e[t]=function(){return console.warn('micro-app: "'+t+'" is an empty function.'),this}})};var a=i.createElement("div");t.createElement=function(e){return a.innerHTML=e,a.firstElementChild},t.defineStaticProperty=function(e,t){return Object.defineProperty(this,e,{value:t,writable:!1,enumerable:!1,configurable:!1}),this},t.hashListener=function(e){function t(e){var t=e.indexOf("#");if(t>-1&&t<e.length-1){var i=e.substring(t+1);n.test(i)||console.warn('micro-app: "location.hash" is in use to save the params.')}}var n=new RegExp("(^|&)("+e.join("|")+")"+encodeURIComponent("="));window.addEventListener("hashchange",function(e){t(e.newURL)}),t(location.href)};var o={};if(location.hash){var c=decodeURIComponent(location.hash.substring(1));c.split("&").forEach(function(e){var t=e.split("="),n=t[0],i=t[1];void 0===i&&(i=""),o[n]=i})}t.hash=function(e,t){return void 0===e?o:void 0===t?o[e]:(o[e]=t,n(),this)},t.hide=function(){return r.removeChild(this),this},t.NaF=function(e){return"function"==typeof e?NaF(e()):e},t.parseArgument=function(e){var t=/\(/.test(e),n=/\)/.test(e);if(!t&&!n)return[e,[]];try{if(!t)throw new SyntaxError('[micro-app] Missing "(" before argument list.');if(!n)throw new SyntaxError('[micro-app] Missing ")" after argument list.');if(!/\)$/.test(e))throw new SyntaxError('[micro-app] Unexpected end of "'+e.match(/.*(\).*$)/)[1]+'".');var i=e.match(/(.*?)\((.*)\)$/),r=i[1],a=i[2];return[r,JSON.parse("["+a+"]")]}catch(o){return setTimeout(function(){throw o},0),[""]}},t.parseFilter=function(e){return e?e.substring(1).split("|"):[]},t.parseUrl=function(e){var t=i.createElement("a");return t.href=e,t};var s=Element.prototype,l=s.setAttribute,u=s.removeAttribute;t.setAttribute=function(e,t){return null===t?u.call(this,e):l.call(this,e,t),this},t.show=function(){return r.appendChild(this),this};var p=navigator.userAgent;t.userAgent={is:{ios:/\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(p),safari:/\bversion\/([0-9.]+(?: beta)?)(?: mobile(?:\/[a-z0-9]+)?)? safari\//i.test(p)},device:/iPad/i.test(p)?"pad":"phone",os:parseInt((p.match(/\bcpu(?: iphone)? os /i.test(p)?/\bcpu(?: iphone)? os ([0-9._]+)/i:/\biph os ([0-9_]+)/i)||[,0])[1])>6?7:6}},function(e,t,n){"use strict";var i=n(1),r=n(3),a=n(4),o=n(5),c=n(6);t.main=function(e){function t(t,n){var r=t instanceof Array?t.slice(0):null===t?[]:[t],a=this.result;this.result=(0,c.createMultiElement)(r,a,{code:this.code,attribute:"href",success:function(e){var t=this,n=!1;(0,i.parseFilter)((0,i.parseUrl)(e).hash).forEach(function(e){if(!n&&""!==e){var r=(0,i.parseArgument)(e),a=r[0],o=r[1],c=l[a];"function"==typeof c&&(n=(0,i.NaF)(c.apply(t,o))===!1)}})}}),i.setAttribute.call(e,this.name,t instanceof Array?s:t)}var n,s=Object.prototype.toString.call([]),l={};(0,i.hashListener)(["href"]),i.defineStaticProperty.call(e,"filter",function(e,t){if(arguments.length<2)throw new TypeError("[micro-app] 2 arguments required, but only "+arguments.length+" present.");if("string"!=typeof e)throw new TypeError("[micro-app] A valid filter name should be string.");if(!e)throw new TypeError("[micro-app] A valid filter name should not be empty string.");if(/[\||\(|\)]/.test(e))throw new TypeError('[micro-app] "'+e+'" is not a valid filter name, "'+e.match(/[\||\(|\)]/)[0]+'" is not allowed.');if("function"!=typeof t)throw new TypeError("[micro-app] The second argument must be a function.");return l[e]=t,this}),e.filter("precomposed",function(){this.rel="apple-touch-icon-precomposed"}),e.filter("autosize",function(){var e="apple-touch-startup-image"===this.getAttribute("rel")?"splash":"icon",t=(0,a.autosize)(e);if(t)for(var n in t)this.setAttribute(n,t[n])});var u=(0,i.createElement)('<meta name="apple-mobile-web-app-capable" content="yes">'),p=(0,i.createElement)('<meta name="apple-mobile-web-app-status-bar-style">'),h=(0,i.createElement)('<meta name="apple-mobile-web-app-title">');(n=(n=(n=(n=(n=(n=(n=(n=(n=o.defineProperty.call(e,{name:"capable",onChange:function(t,n){i.setAttribute.call(e,this.name,t),null===t&&i.hide.call(u),null===n&&i.show.call(u)}}),o.defineProperty).call(n,{name:"statusBarStyle",hyphenName:(0,i.camel2hyphen)("statusBarStyle"),onChange:function(t,n){i.setAttribute.call(e,this.hyphenName,t),i.setAttribute.call(p,"content",t),null===t&&i.hide.call(p),null===n&&i.show.call(p)}}),o.defineProperty).call(n,{name:"title",onChange:function(t,n){i.setAttribute.call(e,this.name,t),i.setAttribute.call(h,"content",t),null===t&&i.hide.call(h),null===n&&i.show.call(h)}}),o.defineProperty).call(n,{result:[],name:"icon",code:'<link rel="apple-touch-icon">',onChange:t}),o.defineProperty).call(n,{result:[],name:"splash",code:'<link rel="apple-touch-startup-image">',onChange:t}),o.defineProperty).call(n,{name:"href",onChange:function(t,n){i.setAttribute.call(e,this.name,t),(0,i.hash)(this.name,t)}}),r.override).call(n,"getAttribute",function(e,t){var n=t[0];if(n in o.defineProperty)return e.stopPropagation(),this[n]}),r.override).call(n,"setAttribute",function(e,t){var n=t[0],i=t[1];if(n in o.defineProperty)return e.stopPropagation(),this[n]=i}),r.override).call(n,"removeAttribute",function(e,t){var n=t[0];if(n in o.defineProperty)return e.stopPropagation(),this[n]=null}),i.defineStaticProperty).call(n,"hash",i.hash)}},function(e,t,n){"use strict";var i=n(1);t.override=function(e,t){var n=this[e];return"function"==typeof n&&i.defineStaticProperty.call(this,e,function(){var e=!0,i=t.call(this,{stopPropagation:function(){e=!1}},arguments);return e?n.apply(this,arguments):i}),this}},function(e,t,n){"use strict";var i=n(1),r=i.userAgent.device,a=i.userAgent.os,o=devicePixelRatio>1?1:0,c={phone:{6:{0:"57x57",1:"114x114"},7:{0:"60x60",1:"120x120"}},pad:{6:{0:"72x72",1:"144x144"},7:{0:"76x76",1:"152x152"}}},s={},l="device-width",u="device-height";"phone"==r?(s[l]=320,s[u]=480,[{width:320,height:568},{width:375,height:667},{width:414,height:736}].forEach(function(e){matchMedia("("+l+":"+e.width+"px)and("+u+":"+e.height+"px)").matches&&(s[l]=e.width,s[u]=e.height)}),s[l]+="px",s[u]+="px"):(s[l]="768px",s[u]="1024px"),s["-webkit-device-pixel-ratio"]=devicePixelRatio,t.autosize=function(e){if("icon"==e){var t=c[r][a][o];return{sizes:t}}if("splash"==e){var n=[];for(var i in s)n.push("("+i+":"+s[i]+")");"pad"!=r&&3!=devicePixelRatio||(matchMedia("(orientation:landscape)").matches?n.push("(orientation:landscape)"):n.push("(orientation:portrait)"));var l=n.join("and");return{media:l}}}},function(e,t,n){"use strict";var i=n(1);t.defineProperty=function r(e){var t=e.name,n=e.hyphenName||t,a=void 0;void 0===e.value?a=e.value=this.getAttribute(n):this.setAttribute(n,a=e.value),null!==a&&e.onChange(a,null);var o={get:function(){return e.value},set:function(t){return t=(0,i.NaF)(t),t!==e.value&&e.onChange(t,e.value),e.value=t},enumerable:!1};return Object.defineProperty(this,t,o),t!=n?(Object.defineProperty(this,n,o),r[t]=r[n]=!0,this):(r[t]=!0,this)}},function(e,t,n){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},r=n(1),a=Element.prototype.getAttribute;t.createMultiElement=function(e,t,n){var o=[],c=n.attribute;t.forEach(function(e){r.hide.call(e)});for(var s=e.length,l=0;l<s;l++){var u=(0,r.NaF)(e[l]);if(null===u);else{var p,h=(p=(0,r.createElement)(n.code),r.show).call(p);if("object"==("undefined"==typeof u?"undefined":i(u))){r.setAttribute.call(h,c,void 0);for(var f in u)r.setAttribute.call(h,f,(0,r.NaF)(u[f]))}else r.setAttribute.call(h,c,u);var d=a.call(h,c);r.setAttribute.call(h,"original-"+c,d),d.indexOf("#")>-1&&r.setAttribute.call(h,c,d.split("#")[0]),n.success&&n.success.call(h,d),o.push(h)}}return o}},function(e,t,n){"use strict";var i=n(1);t.standalone=function(){var e=(0,i.hash)("href");if(e){var t=document.createEvent("CustomEvent");t.initEvent("redirect",!1,!0),window.dispatchEvent(t)&&location.replace(e)}}}])});
{
"name": "micro-app",
"version": "0.0.6",
"version": "0.0.7",
"description": "[iOS] Integrated Safari features about web app.",

@@ -5,0 +5,0 @@ "main": "dist/micro-app.min.js",

@@ -7,2 +7,3 @@ 'use strict';

// concat util
let src = path.join(__dirname, '../src/modules/util/');

@@ -18,2 +19,6 @@ let dest = path.join(__dirname, '../src/modules/util.js');

}
if (process.platform == 'win32') {
// put `_variable` first
files.unshift(files.pop());
}
files.forEach(( file ) => {

@@ -20,0 +25,0 @@ result.push(`//---------- ./${ file } ----------\n`);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc