From 7e8a3a55b8907c0ed7f0053fab6c23b6601ebea0 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 7 Nov 2016 23:25:29 -0500 Subject: [PATCH] Simplify rules --- .eslintrc.yml | 5 +- .../smart-app-banner.css | 0 dist/smart-app-banner.js | 35 +++ index.css | 292 ++++++++++++++++++ index.js | 2 + package.json | 10 +- smart-app-banner.js | 34 -- test/index.html | 4 +- 8 files changed, 336 insertions(+), 46 deletions(-) rename smart-app-banner.css => dist/smart-app-banner.css (100%) create mode 100644 dist/smart-app-banner.js create mode 100644 index.css delete mode 100644 smart-app-banner.js diff --git a/.eslintrc.yml b/.eslintrc.yml index 26ff6ea..42fcecb 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -4,13 +4,12 @@ env: extends: 'eslint:recommended' rules: no-undef: - - ignore + - 0 indent: - error - tab linebreak-style: - - error - - unix + - 0 quotes: - error - single diff --git a/smart-app-banner.css b/dist/smart-app-banner.css similarity index 100% rename from smart-app-banner.css rename to dist/smart-app-banner.css diff --git a/dist/smart-app-banner.js b/dist/smart-app-banner.js new file mode 100644 index 0000000..8b88603 --- /dev/null +++ b/dist/smart-app-banner.js @@ -0,0 +1,35 @@ +(function(u){"object"===typeof exports&&"undefined"!==typeof module?module.exports=u():"function"===typeof define&&define.amd?define([],u):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).SmartBanner=u()})(function(){return function c(f,h,e){function b(d,v){if(!h[d]){if(!f[d]){var g="function"==typeof require&&require;if(!v&&g)return g(d,!0);if(a)return a(d,!0);g=Error("Cannot find module '"+d+"'");throw g.code="MODULE_NOT_FOUND",g;}g=h[d]= +{exports:{}};f[d][0].call(g.exports,function(a){var e=f[d][1][a];return b(e?e:a)},g,g.exports,c,f,h,e)}return h[d].exports}for(var a="function"==typeof require&&require,d=0;d
'+this.options.title+"
"+this.options.author+"
"+e+'
'+this.options.button+"";a.body?a.body.appendChild(q):a&&a.addEventListener("DOMContentLoaded",function(){a.body.appendChild(q)});b(".smartbanner-button",q).addEventListener("click",this.install.bind(this),!1);b(".smartbanner-close",q).addEventListener("click",this.close.bind(this),!1)},hide:function(){p.classList.remove("smartbanner-show")},show:function(){p.classList.add("smartbanner-show")},close:function(){this.hide(); +d.set("smartbanner-closed","true",{path:"/",expires:new Date(Number(new Date)+864E5*this.options.daysHidden)})},install:function(){this.hide();d.set("smartbanner-installed","true",{path:"/",expires:new Date(Number(new Date)+864E5*this.options.daysReminder)})},parseAppId:function(){var a=b('meta[name="'+this.appMeta+'"]');if(a)return this.appId="windows"===this.type?a.getAttribute("content"):/app-id=([^\s,]+)/.exec(a.getAttribute("content"))[1]}};f.exports=c},{"component-query":2,"cookie-cutter":3, +"get-doc":4,"ua-parser-js":6,"xtend/mutable":7}],2:[function(c,f,h){function e(b,a){return a.querySelector(b)}h=f.exports=function(b,a){a=a||document;return e(b,a)};h.all=function(b,a){a=a||document;return a.querySelectorAll(b)};h.engine=function(b){if(!b.one)throw Error(".one callback required");if(!b.all)throw Error(".all callback required");e=b.one;h.all=b.all;return h}},{}],3:[function(c,f,h){h=f.exports=function(e){e||(e={});"string"===typeof e&&(e={cookie:e});void 0===e.cookie&&(e.cookie=""); +return{get:function(b){for(var a=e.cookie.split(/;\s*/),d=0;d smart-app-banner.js", - "precommit": "xo --fix index.js && stylefmt smart-app-banner.css && npm run test && npm run build", - "test": "xo" + "build": "browserify index.js -s SmartBanner | ccjs - > dist/smart-app-banner.js", + "lint": "eslint index.js" }, "repository": { "type": "git", @@ -46,10 +45,7 @@ }, "devDependencies": { "browserify": "^10.2.4", - "ccjs": "^0.2.0", "closurecompiler": "^1.5.1", - "eslint": "^3.9.1", - "stylefmt": "^4.3.1", - "xo": "^0.17.0" + "eslint": "^3.9.1" } } diff --git a/smart-app-banner.js b/smart-app-banner.js deleted file mode 100644 index cf508c5..0000000 --- a/smart-app-banner.js +++ /dev/null @@ -1,34 +0,0 @@ -(function(u){"object"===typeof exports&&"undefined"!==typeof module?module.exports=u():"function"===typeof define&&define.amd?define([],u):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).SmartBanner=u()})(function(){return function f(g,h,e){function b(c,v){if(!h[c]){if(!g[c]){var d="function"==typeof require&&require;if(!v&&d)return d(c,!0);if(a)return a(c,!0);d=Error("Cannot find module '"+c+"'");throw d.code="MODULE_NOT_FOUND",d;}d=h[c]= -{exports:{}};g[c][0].call(d.exports,function(a){var e=g[c][1][a];return b(e?e:a)},d,d.exports,f,g,h,e)}return h[c].exports}for(var a="function"==typeof require&&require,c=0;c
'+this.options.title+"
"+this.options.author+"
"+e+'
'+this.options.button+"";a.body?a.body.appendChild(d):a&&a.addEventListener("DOMContentLoaded",function(){a.body.appendChild(d)});b(".smartbanner-button",d).addEventListener("click",this.install.bind(this),!1);b(".smartbanner-close",d).addEventListener("click",this.close.bind(this),!1)},hide:function(){n.classList.remove("smartbanner-show")},show:function(){n.classList.add("smartbanner-show")},close:function(){this.hide(); -c.set("smartbanner-closed","true",{path:"/",expires:new Date(Number(new Date)+864E5*this.options.daysHidden)})},install:function(){this.hide();c.set("smartbanner-installed","true",{path:"/",expires:new Date(Number(new Date)+864E5*this.options.daysReminder)})},parseAppId:function(){var a=b('meta[name="'+this.appMeta+'"]');if(a)return this.appId="windows"===this.type?a.getAttribute("content"):/app-id=([^\s,]+)/.exec(a.getAttribute("content"))[1]}};g.exports=f},{"component-query":2,"cookie-cutter":3, -"get-doc":4,"ua-parser-js":6,"xtend/mutable":7}],2:[function(f,g,h){function e(b,a){return a.querySelector(b)}h=g.exports=function(b,a){a=a||document;return e(b,a)};h.all=function(b,a){a=a||document;return a.querySelectorAll(b)};h.engine=function(b){if(!b.one)throw Error(".one callback required");if(!b.all)throw Error(".all callback required");e=b.one;h.all=b.all;return h}},{}],3:[function(f,g,h){h=g.exports=function(e){e||(e={});"string"===typeof e&&(e={cookie:e});void 0===e.cookie&&(e.cookie=""); -return{get:function(b){for(var a=e.cookie.split(/;\s*/),c=0;c - + @@ -27,7 +27,7 @@ } - +