diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..12c0113 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ + language: node_js + node_js: + - 0.10 \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index f69d7b6..a22bfda 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,58 +1,61 @@ -module.exports = function(grunt) { - grunt.initConfig({ - clean: { - build: { - src: ['build/'] - }, - all: { - src: ['build/', 'dist/'] - } - }, - dataUri: { - dist: { - src: ['src/*.css'], - dest: 'build/', - options: { - target: ['**'], - fixDirLevel: true - }, - }, - }, - cssmin: { - combine: { - files: { - 'build/button.min.css': ['build/button.css'] - }, - }, - }, - concat: { - options: { - process: function(src, filepath) { - var css = grunt.file.read('build/button.min.css'); - return src.replace('[[minified_css]]', css); - }, - }, - dist: { - src: ['src/button.js'], - dest: 'build/button.js' - }, - }, - uglify: { - options: { - mangle: false - }, - dist: { - files: { - 'dist/whatsapp-button.js': ['build/button.js'] - } - } - }, - - }); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-data-uri'); - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.registerTask('default', ['clean:all', 'dataUri', 'cssmin', 'concat', 'uglify', 'clean:build']); +module.exports = function (grunt) { + grunt.initConfig({ + clean: { + build: { + src: ['build/'] + }, + all: { + src: ['build/', 'dist/'] + } + }, + dataUri: { + dist: { + src: ['src/*.css'], + dest: 'build/', + options: { + target: ['**'], + fixDirLevel: true + } + } + }, + cssmin: { + combine: { + files: { + 'build/button.min.css': ['build/button.css'] + } + } + }, + concat: { + options: { + process: function (src, filepath) { + var css = grunt.file.read('build/button.min.css'); + return src.replace('[[minified_css]]', css); + } + }, + dist: { + src: ['src/button.js'], + dest: 'build/button.js' + } + }, + uglify: { + options: { + mangle: false + }, + dist: { + files: { + 'dist/whatsapp-button.js': ['build/button.js'] + } + } + }, + jshint: { + button: ['src/button.js'] + } + }); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-data-uri'); + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.registerTask('default', ['jshint:button', 'clean:all', 'dataUri', 'cssmin', 'concat', 'uglify', 'clean:build']); }; \ No newline at end of file diff --git a/ISSUES.md b/ISSUES.md index 480e0a2..13dcb17 100644 --- a/ISSUES.md +++ b/ISSUES.md @@ -4,6 +4,6 @@ Okay, you're going to report an issue: 1. Take a look at the [FAQs](https://github.com/kriskbx/whatsapp-sharing#faq) first - maybe there's something that solves your issue. 2. Take a look at the [issues](https://github.com/kriskbx/whatsapp-sharing/issues) already reported and +1 if you're experiencing the same problem. -3. Open your Browsers JavaScript console on your website and type `theWaShBtn`. If you see something like this `theWaShBtn is not defined` the library is not loaded. Repeat the installation steps! +3. Open your Browsers JavaScript console on your website and type `WASHAREBTN`. If you see something like this `WASHAREBTN is not defined` the library is not loaded. Repeat the installation steps! 4. Provide an example: this can be a link to your website or a jsfiddle. We can't help you without code we can take a look at. 5. Happy reporting. \ No newline at end of file diff --git a/README.md b/README.md index c30a429..0437d40 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # WhatsApp sharing button -[![Code Climate](https://codeclimate.com/github/kriskbx/whatsapp-sharing/badges/gpa.svg)](https://codeclimate.com/github/kriskbx/whatsapp-sharing) +[![Tips](https://img.shields.io/gratipay/kriskbx.svg)](https://www.gittip.com/kriskbx/) [![Travis](https://img.shields.io/travis/kriskbx/whatsapp-sharing.svg)](https://travis-ci.org/kriskbx/whatsapp-sharing) [![Code Climate](https://img.shields.io/codeclimate/github/kriskbx/whatsapp-sharing.svg)](https://codeclimate.com/github/kriskbx/whatsapp-sharing) [![Release](https://img.shields.io/github/release/kriskbx/whatsapp-sharing.svg)](https://github.com/kriskbx/whatsapp-sharing) [![GitHub license](https://img.shields.io/github/license/kriskbx/whatsapp-sharing.svg)](https://github.com/kriskbx/whatsapp-sharing/blob/master/LICENSE) [![Npm](https://img.shields.io/npm/dm/whatsapp-sharing.svg)](https://www.npmjs.com/package/whatsapp-sharing) + ## Installation @@ -31,7 +32,7 @@ If you want to customize the size, style, url or the sharing text, feel free to ### 1. I'm using AJAX? -Run `theWaShBtn.crBtn();` after you loaded your content. +Run `WASHAREBTN.crBtn();` after you loaded your content. ### 2. I want to track clicks on the button @@ -44,3 +45,8 @@ Nope, that's not possible (at the moment). ### 4. If WhatsApp is not installed on the device there's an error message It's not possible to check if WhatsApp is installed on the device. This is a good thing, imagine a webpage can access the list of installed applications. + + +## License + +MIT \ No newline at end of file diff --git a/bower.json b/bower.json index 5ba8fd7..e3fb466 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "whatsapp-sharing", - "version": "1.2.3", + "version": "1.3.0", "homepage": "https://github.com/kriskbx/whatsapp-sharing", "authors": [ "kriskbx" diff --git a/dist/whatsapp-button.js b/dist/whatsapp-button.js index 303eb01..a942afd 100644 --- a/dist/whatsapp-button.js +++ b/dist/whatsapp-button.js @@ -1 +1 @@ -(function(){var root=this;WASHAREBUTTON=function(){this.isIos===!0&&this.cntLdd(window,this.crBtn)},WASHAREBUTTON.prototype.isIos=navigator.userAgent.match(/Android|iPhone/i)&&!navigator.userAgent.match(/iPod|iPad/i)?!0:!1,WASHAREBUTTON.prototype.cntLdd=function(win,fn){var done=!1,top=!0,doc=win.document,root=doc.documentElement,add=doc.addEventListener?"addEventListener":"attachEvent",rem=doc.addEventListener?"removeEventListener":"detachEvent",pre=doc.addEventListener?"":"on",init=function(e){("readystatechange"!==e.type||"complete"===doc.readyState)&&(("load"==e.type?win:doc)[rem](pre+e.type,init,!1),!done&&(done=!0)&&fn.call(win,e.type||e))},poll=function(){try{root.doScroll("left")}catch(e){return void setTimeout(poll,50)}init("poll")};if("complete"===doc.readyState)fn.call(win,"lazy");else{if(doc.createEventObject&&root.doScroll){try{top=!win.frameElement}catch(e){}top&&poll()}doc[add](pre+"DOMContentLoaded",init,!1),doc[add](pre+"readystatechange",init,!1),win[add](pre+"load",init,!1)}},WASHAREBUTTON.prototype.addStyling=function(){var s=document.createElement("style"),c="body,html{padding:0;margin:0;height:100%;width:100%}.wa_btn{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkViZW5lXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgMTYgMTYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDE2IDE2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxnPg0KCQk8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0ZGRkZGRiIgZD0iTTguMTI5LDAuOTQ1Yy0zLjc5NSwwLTYuODcyLDMuMDc3LTYuODcyLDYuODczDQoJCQljMCwxLjI5OCwwLjM2LDIuNTEyLDAuOTg2LDMuNTQ5bC0xLjI0LDMuNjg4bDMuODA1LTEuMjE5YzAuOTg0LDAuNTQ0LDIuMTE2LDAuODU0LDMuMzIxLDAuODU0YzMuNzk1LDAsNi44NzEtMy4wNzU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LjU2NSwxLjcyMiwwLjY0OCwxLjg0MWMwLjA4NCwwLjEyMSwxLjE0LDEuOTkxLDIuODk3LDIuNzYyYzEuNzU2LDAuNzcsMS43NjYsMC41MzQsMi4wODgsMC41MTgNCgkJCWMwLjMyMi0wLjAxOCwxLjA1NS0wLjM4NiwxLjIxNS0wLjc4OWMwLjE2Mi0wLjQwNSwwLjE3Ni0wLjc1NSwwLjEzNS0wLjgzMUMxMS42MzksOS41MjEsMTEuNTIzLDkuNDc1LDExLjM1Miw5LjM3OXoiLz4NCgk8L2c+DQo8L2c+DQo8L3N2Zz4NCg==);border:1px solid rgba(0,0,0,.1);display:inline-block!important;position:relative;font-family:Arial,sans-serif;letter-spacing:.4px;cursor:pointer;font-weight:400;text-transform:none;color:#fff;border-radius:2px;background-color:#5cbe4a;background-repeat:no-repeat;line-height:1.2;text-decoration:none;text-align:left}.wa_btn_s{font-size:12px;background-size:16px;background-position:5px 2px;padding:3px 6px 3px 25px}.wa_btn_m{font-size:16px;background-size:20px;background-position:4px 2px;padding:4px 6px 4px 30px}.wa_btn_l{font-size:16px;background-size:20px;background-position:5px 5px;padding:8px 6px 8px 30px}";return s.type="text/css",s.styleSheet?s.styleSheet.cssText=c:s.appendChild(document.createTextNode(c)),s},WASHAREBUTTON.prototype.crBtn=function(){for(var bn=document.querySelectorAll(".wa_btn"),b=[].slice.call(bn),iframe=[],i=0;i WABTN Tester + - + Small:

- +

Medium:

- +

- + Large:

- +

- + \ No newline at end of file