diff --git a/README.md b/README.md index c8eff886..1160ff60 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,6 @@ Useful ~~jQuery plugin~~ modern JavaScript solution that will help your website ### Features Simple install, extensive documentation, developer support, **SEO friendly**, many options for customization of appearance, **clean code without scripts tracking user activity** on the page, **high speed**. -### Live demo - -~~Yes. We have a simple live demo! [Just click me](https://koddr.me/projects/examples/goodshare-js) :D~~ Comming soon. - ## Install via `npm` (recommended) ```bash @@ -42,7 +38,7 @@ Download [goodshare.min.js](https://raw.githubusercontent.com/koddr/goodshare.js * `vkontakte` [Вконтакте](http://vk.com) * `facebook` [Facebook](http://facebook.com) * `odnoklassniki` [Одноклассники](http://ok.ru) -* `mymailru` [Мой Мир@Mail.Ru](http://my.mail.ru) +* `moimir` [Мой Мир@Mail.Ru](http://my.mail.ru) * `googleplus` [Google Plus](http://plus.google.com) * `linkedin` [LinkedIn](http://linkedin.com) * `twitter` [Twitter](http://twitter.com) diff --git a/dist/goodshare.js b/dist/goodshare.js index d2a09f73..3a4bf0dc 100644 --- a/dist/goodshare.js +++ b/dist/goodshare.js @@ -1,61 +1,56 @@ -'use strict'; - -var _Vkontakte = require('./providers/Vkontakte'); - -var _Facebook = require('./providers/Facebook'); - -var _Odnoklassniki = require('./providers/Odnoklassniki'); - -var _MoiMir = require('./providers/MoiMir'); - -var _GooglePlus = require('./providers/GooglePlus'); - -var _LinkedIn = require('./providers/LinkedIn'); - -var _Tumblr = require('./providers/Tumblr'); - -var _Pinterest = require('./providers/Pinterest'); - -var _Surfingbird = require('./providers/Surfingbird'); - -var _Reddit = require('./providers/Reddit'); - -var _Buffer = require('./providers/Buffer'); - -var _StumbleUpon = require('./providers/StumbleUpon'); - -var _Pocket = require('./providers/Pocket'); - -var _Xing = require('./providers/Xing'); - -var _Twitter = require('./providers/Twitter'); - -var _LiveJournal = require('./providers/LiveJournal'); - -var _Evernote = require('./providers/Evernote'); - -var _Delicious = require('./providers/Delicious'); - -var _Blogger = require('./providers/Blogger'); - -var _Instapaper = require('./providers/Instapaper'); - -var _Digg = require('./providers/Digg'); - -var _LiveInternet = require('./providers/LiveInternet'); - -var _WordPress = require('./providers/WordPress'); - -var _Baidu = require('./providers/Baidu'); - -var _RenRen = require('./providers/RenRen'); - -var _Weibo = require('./providers/Weibo'); - -var _Telegram = require('./providers/Telegram'); - -var _Viber = require('./providers/Viber'); - -var _WhatsApp = require('./providers/WhatsApp'); - -var _Line = require('./providers/Line'); \ No newline at end of file +/** + * Vikky Shostak + * Copyright (c) 2017 Koddr https://koddr.me + * http://opensource.org/licenses/MIT The MIT License (MIT) + * + * goodshare.js v4.0.6 at 03/02/2017 (20:00) + * + * Useful modern JavaScript solution that will help your website visitors share a + * link on social networks and microblogs. Easy to install and configuring on + * any of your website! + */ + +/** + * Import social networks providers with share counter. + */ + +import { vkontakte_share, vkontakte_counter } from './providers/Vkontakte'; +import { facebook_share, facebook_counter } from './providers/Facebook'; +import { odnoklassniki_share, odnoklassniki_counter } from './providers/Odnoklassniki'; +import { moimir_share, moimir_counter } from './providers/MoiMir'; +import { googleplus_share, googleplus_counter } from './providers/GooglePlus'; +import { linkedin_share, linkedin_counter } from './providers/LinkedIn'; +import { tumblr_share, tumblr_counter } from './providers/Tumblr'; +import { pinterest_share, pinterest_counter } from './providers/Pinterest'; +import { surfingbird_share, surfingbird_counter } from './providers/Surfingbird'; +import { reddit_share, reddit_counter } from './providers/Reddit'; +import { buffer_share, buffer_counter } from './providers/Buffer'; +import { stumbleupon_share, stumbleupon_counter } from './providers/StumbleUpon'; +import { pocket_share, pocket_counter } from './providers/Pocket'; +import { xing_share, xing_counter } from './providers/Xing'; + +/** + * Import social networks providers without share counter. + */ + +import { twitter_share } from './providers/Twitter'; +import { livejournal_share } from './providers/LiveJournal'; +import { evernote_share } from './providers/Evernote'; +import { delicious_share } from './providers/Delicious'; +import { blogger_share } from './providers/Blogger'; +import { instapaper_share } from './providers/Instapaper'; +import { digg_share } from './providers/Digg'; +import { liveinternet_share } from './providers/LiveInternet'; +import { wordpress_share } from './providers/WordPress'; +import { baidu_share } from './providers/Baidu'; +import { renren_share } from './providers/RenRen'; +import { weibo_share } from './providers/Weibo'; + +/** + * Import mobile messengers providers. + */ + +import { telegram_share } from './providers/Telegram'; +import { viber_share } from './providers/Viber'; +import { whatsapp_share } from './providers/WhatsApp'; +import { line_share } from './providers/Line'; \ No newline at end of file diff --git a/dist/providers/Baidu.js b/dist/providers/Baidu.js index 2343188f..80b71ab7 100644 --- a/dist/providers/Baidu.js +++ b/dist/providers/Baidu.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,35 +8,24 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Baidu (https://baidu.com) provider. */ -var Baidu = function () { - function Baidu() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - var description = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.querySelector('meta[name=description]'); - - _classCallCheck(this, Baidu); - +class Baidu { + constructor(url = document.location.href, title = document.title, description = document.querySelector('meta[name=description]')) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); this.description = description ? encodeURIComponent(description.content) : ''; } - _createClass(Baidu, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=baidu]'); - var share_url = 'https://cang.baidu.com/do/add?iu=' + this.url + '&it=' + this.title + '&dc=' + this.description + '&fr=ien'; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=baidu]'); + let share_url = 'https://cang.baidu.com/do/add?iu=' + this.url + '&it=' + this.title + '&dc=' + this.description + '&fr=ien'; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Baidu; -}(); + }); + } +} -var baidu_share = exports.baidu_share = new Baidu().shareWindow(); \ No newline at end of file +export let baidu_share = new Baidu().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Blogger.js b/dist/providers/Blogger.js index ead0d400..73ff5e62 100644 --- a/dist/providers/Blogger.js +++ b/dist/providers/Blogger.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,33 +8,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Blogger (https://blogger.com) provider. */ -var Blogger = function () { - function Blogger() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Blogger); - +class Blogger { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Blogger, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=blogger]'); - var share_url = 'https://www.blogger.com/blog-this.g?u=' + this.url + '&n=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=blogger]'); + let share_url = 'https://www.blogger.com/blog-this.g?u=' + this.url + '&n=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Blogger; -}(); + }); + } +} -var blogger_share = exports.blogger_share = new Blogger().shareWindow(); \ No newline at end of file +export let blogger_share = new Blogger().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Buffer.js b/dist/providers/Buffer.js index 79af970e..3d99b024 100644 --- a/dist/providers/Buffer.js +++ b/dist/providers/Buffer.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,55 +8,44 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Buffer (https://buffer.com) provider. */ -var Buffer = function () { - function Buffer() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Buffer); - +class Buffer { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Buffer, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=buffer]'); - var share_url = 'https://buffer.com/add?url=' + this.url + '&text=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=buffer]'); + let share_url = 'https://buffer.com/add?url=' + this.url + '&text=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=buffer]'); - var count_url = 'https://api.bufferapp.com/1/links/shares.json?url=' + this.url + '&callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.length > 0 ? counter.shares : 0; - }); + getCounter() { + let script = document.createElement('script'); + let callback = ('goodshare_' + Math.random()).replace('.', ''); + let count_elements = document.querySelectorAll('[data-counter=buffer]'); + let count_url = 'https://api.bufferapp.com/1/links/shares.json?url=' + this.url + '&callback=' + callback; - script.parentNode.removeChild(script); - }; + if (count_elements.length > 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.length > 0 ? counter.shares : 0; + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return Buffer; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var buffer_share = exports.buffer_share = new Buffer().shareWindow(); -var buffer_counter = exports.buffer_counter = new Buffer().getCounter(); \ No newline at end of file +export let buffer_share = new Buffer().shareWindow(); +export let buffer_counter = new Buffer().getCounter(); \ No newline at end of file diff --git a/dist/providers/Delicious.js b/dist/providers/Delicious.js index 0fb749ad..093a1aad 100644 --- a/dist/providers/Delicious.js +++ b/dist/providers/Delicious.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,33 +8,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Delicious (https://delicious.com) provider. */ -var Delicious = function () { - function Delicious() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Delicious); - +class Delicious { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Delicious, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=delicious]'); - var share_url = 'https://del.icio.us/save?url=' + this.url + '&title=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=delicious]'); + let share_url = 'https://del.icio.us/save?url=' + this.url + '&title=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Delicious; -}(); + }); + } +} -var delicious_share = exports.delicious_share = new Delicious().shareWindow(); \ No newline at end of file +export let delicious_share = new Delicious().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Digg.js b/dist/providers/Digg.js index 0305fe45..554c3c1f 100644 --- a/dist/providers/Digg.js +++ b/dist/providers/Digg.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,33 +8,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Digg (https://digg.com) provider. */ -var Digg = function () { - function Digg() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Digg); - +class Digg { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Digg, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=digg]'); - var share_url = 'http://digg.com/submit?url=' + this.url + '&title=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=digg]'); + let share_url = 'http://digg.com/submit?url=' + this.url + '&title=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Digg; -}(); + }); + } +} -var digg_share = exports.digg_share = new Digg().shareWindow(); \ No newline at end of file +export let digg_share = new Digg().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Evernote.js b/dist/providers/Evernote.js index 90676a00..a4614924 100644 --- a/dist/providers/Evernote.js +++ b/dist/providers/Evernote.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,35 +8,24 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Evernote (https://evernote.com) provider. */ -var Evernote = function () { - function Evernote() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - var description = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.querySelector('meta[name=description]'); - - _classCallCheck(this, Evernote); - +class Evernote { + constructor(url = document.location.href, title = document.title, description = document.querySelector('meta[name=description]')) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); this.description = description ? encodeURIComponent(description.content) : ''; } - _createClass(Evernote, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=evernote]'); - var share_url = 'https://www.evernote.com/clip.action?url=' + this.url + '&title=' + this.title + '&body=' + this.description; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=evernote]'); + let share_url = 'https://www.evernote.com/clip.action?url=' + this.url + '&title=' + this.title + '&body=' + this.description; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Evernote; -}(); + }); + } +} -var evernote_share = exports.evernote_share = new Evernote().shareWindow(); \ No newline at end of file +export let evernote_share = new Evernote().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Facebook.js b/dist/providers/Facebook.js index e019749d..011ffdf4 100644 --- a/dist/providers/Facebook.js +++ b/dist/providers/Facebook.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,55 +8,44 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Facebook (https://facebook.com) provider. */ -var Facebook = function () { - function Facebook() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Facebook); - +class Facebook { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Facebook, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=facebook]'); - var share_url = 'https://facebook.com/sharer/sharer.php?u=' + this.url + '&t=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=facebook]'); + let share_url = 'https://facebook.com/sharer/sharer.php?u=' + this.url + '&t=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=facebook]'); - var count_url = 'https://graph.facebook.com/?id=' + this.url + '&callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.share ? counter.share.share_count : 0; - }); + getCounter() { + let script = document.createElement('script'); + let callback = ('goodshare_' + Math.random()).replace('.', ''); + let count_elements = document.querySelectorAll('[data-counter=facebook]'); + let count_url = 'https://graph.facebook.com/?id=' + this.url + '&callback=' + callback; - script.parentNode.removeChild(script); - }; + if (count_elements.length > 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.share ? counter.share.share_count : 0; + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return Facebook; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var facebook_share = exports.facebook_share = new Facebook().shareWindow(); -var facebook_counter = exports.facebook_counter = new Facebook().getCounter(); \ No newline at end of file +export let facebook_share = new Facebook().shareWindow(); +export let facebook_counter = new Facebook().getCounter(); \ No newline at end of file diff --git a/dist/providers/GooglePlus.js b/dist/providers/GooglePlus.js index 02ef29a1..7677dab7 100644 --- a/dist/providers/GooglePlus.js +++ b/dist/providers/GooglePlus.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,53 +8,43 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Google Plus (https://plus.google.com) provider. */ -var GooglePlus = function () { - function GooglePlus() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - - _classCallCheck(this, GooglePlus); - +class GooglePlus { + constructor(url = document.location.href) { this.url = encodeURIComponent(url); } - _createClass(GooglePlus, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=googleplus]'); - var share_url = 'https://plus.google.com/share?url=' + this.url; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=googleplus]'); + let share_url = 'https://plus.google.com/share?url=' + this.url; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=googleplus]'); - var count_url = 'https://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="https://plusone.google.com/_/+1/fastbutton?url=' + this.url + '" and xpath="*"') + '&callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.results[0].match(/javascript">window.__SSR = \{c: (\d+).0/) !== null ? counter.results[0].match(/javascript">window.__SSR = \{c: (\d+).0/)[1] / 1 : 0; - }); + getCounter() { + let script = document.createElement('script'); + let callback = ('goodshare_' + Math.random()).replace('.', ''); + let count_elements = document.querySelectorAll('[data-counter=googleplus]'); + let count_url = 'https://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="https://plusone.google.com/_/+1/fastbutton?url=' + this.url + '" and xpath="*"') + '&callback=' + callback; - script.parentNode.removeChild(script); - }; + if (count_elements.length > 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.results[0].match(/javascript">window.__SSR = \{c: (\d+).0/) !== null ? counter.results[0].match(/javascript">window.__SSR = \{c: (\d+).0/)[1] / 1 : 0; + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return GooglePlus; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var googleplus_share = exports.googleplus_share = new GooglePlus().shareWindow(); -var googleplus_counter = exports.googleplus_counter = new GooglePlus().getCounter(); \ No newline at end of file +export let googleplus_share = new GooglePlus().shareWindow(); +export let googleplus_counter = new GooglePlus().getCounter(); \ No newline at end of file diff --git a/dist/providers/Instapaper.js b/dist/providers/Instapaper.js index 06dd5d0e..edfd13e7 100644 --- a/dist/providers/Instapaper.js +++ b/dist/providers/Instapaper.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,33 +8,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Instapaper (https://instapaper.com) provider. */ -var Instapaper = function () { - function Instapaper() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Instapaper); - +class Instapaper { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Instapaper, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=instapaper]'); - var share_url = 'https://www.instapaper.com/edit?url=' + this.url + '&title=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=instapaper]'); + let share_url = 'https://www.instapaper.com/edit?url=' + this.url + '&title=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Instapaper; -}(); + }); + } +} -var instapaper_share = exports.instapaper_share = new Instapaper().shareWindow(); \ No newline at end of file +export let instapaper_share = new Instapaper().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Line.js b/dist/providers/Line.js index b4b03bca..a2d3fc9c 100644 --- a/dist/providers/Line.js +++ b/dist/providers/Line.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,31 +8,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * LINE (https://line.me) provider. */ -var Line = function () { - function Line() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - - _classCallCheck(this, Line); - +class Line { + constructor(url = document.location.href) { this.url = encodeURIComponent(url); } - _createClass(Line, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=line]'); - var share_url = 'line://msg/text/' + this.url; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=line]'); + let share_url = 'line://msg/text/' + this.url; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Line; -}(); + }); + } +} -var line_share = exports.line_share = new Line().shareWindow(); \ No newline at end of file +export let line_share = new Line().shareWindow(); \ No newline at end of file diff --git a/dist/providers/LinkedIn.js b/dist/providers/LinkedIn.js index 8291b344..6aa6d859 100644 --- a/dist/providers/LinkedIn.js +++ b/dist/providers/LinkedIn.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,57 +8,45 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * LinkedIn (https://linkedin.com) provider. */ -var LinkedIn = function () { - function LinkedIn() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - var description = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.querySelector('meta[name=description]'); - - _classCallCheck(this, LinkedIn); - +class LinkedIn { + constructor(url = document.location.href, title = document.title, description = document.querySelector('meta[name=description]')) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); this.description = description ? encodeURIComponent(description.content) : ''; } - _createClass(LinkedIn, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=linkedin]'); - var share_url = 'http://www.linkedin.com/shareArticle?url=' + this.url + '&text=' + this.title + '&summary=' + this.description + '&mini=true'; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=linkedin]'); + let share_url = 'http://www.linkedin.com/shareArticle?url=' + this.url + '&text=' + this.title + '&summary=' + this.description + '&mini=true'; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=linkedin]'); - var count_url = 'https://www.linkedin.com/countserv/count/share?url=' + this.url + '&callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.count; - }); + getCounter() { + let script = document.createElement('script'); + let callback = ('goodshare_' + Math.random()).replace('.', ''); + let count_elements = document.querySelectorAll('[data-counter=linkedin]'); + let count_url = 'https://www.linkedin.com/countserv/count/share?url=' + this.url + '&callback=' + callback; - script.parentNode.removeChild(script); - }; + if (count_elements.length > 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.count; + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return LinkedIn; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var linkedin_share = exports.linkedin_share = new LinkedIn().shareWindow(); -var linkedin_counter = exports.linkedin_counter = new LinkedIn().getCounter(); \ No newline at end of file +export let linkedin_share = new LinkedIn().shareWindow(); +export let linkedin_counter = new LinkedIn().getCounter(); \ No newline at end of file diff --git a/dist/providers/LiveInternet.js b/dist/providers/LiveInternet.js index 14419bed..1178ad8d 100644 --- a/dist/providers/LiveInternet.js +++ b/dist/providers/LiveInternet.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,33 +8,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * LiveInternet (http://liveinternet.ru) provider. */ -var LiveInternet = function () { - function LiveInternet() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, LiveInternet); - +class LiveInternet { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(LiveInternet, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=liveinternet]'); - var share_url = 'http://www.liveinternet.ru/journal_post.php?action=n_add&cnurl=' + this.url + '&cntitle=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=liveinternet]'); + let share_url = 'http://www.liveinternet.ru/journal_post.php?action=n_add&cnurl=' + this.url + '&cntitle=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return LiveInternet; -}(); + }); + } +} -var liveinternet_share = exports.liveinternet_share = new LiveInternet().shareWindow(); \ No newline at end of file +export let liveinternet_share = new LiveInternet().shareWindow(); \ No newline at end of file diff --git a/dist/providers/LiveJournal.js b/dist/providers/LiveJournal.js index 0df75c91..45dc2fc7 100644 --- a/dist/providers/LiveJournal.js +++ b/dist/providers/LiveJournal.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,33 +8,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * LiveJournal (https://livejournal.com) provider. */ -var LiveJournal = function () { - function LiveJournal() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, LiveJournal); - +class LiveJournal { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(LiveJournal, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=livejournal]'); - var share_url = 'http://livejournal.com/update.bml?event=' + this.url + '&subject=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=livejournal]'); + let share_url = 'http://livejournal.com/update.bml?event=' + this.url + '&subject=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return LiveJournal; -}(); + }); + } +} -var livejournal_share = exports.livejournal_share = new LiveJournal().shareWindow(); \ No newline at end of file +export let livejournal_share = new LiveJournal().shareWindow(); \ No newline at end of file diff --git a/dist/providers/MoiMir.js b/dist/providers/MoiMir.js index 7b12dc35..c14a4fa0 100644 --- a/dist/providers/MoiMir.js +++ b/dist/providers/MoiMir.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,60 +8,47 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * My@Mail.Ru (https://my.mail.ru) provider. */ -var MoiMir = function () { - function MoiMir() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - var description = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.querySelector('meta[name=description]'); - var image = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document.querySelector('link[rel=image_src]'); - - _classCallCheck(this, MoiMir); - +class MoiMir { + constructor(url = document.location.href, title = document.title, description = document.querySelector('meta[name=description]'), image = document.querySelector('link[rel=image_src]')) { this.url = url; this.title = encodeURIComponent(title); this.description = description ? encodeURIComponent(description.content) : ''; this.image = image ? encodeURIComponent(image.href) : ''; } - _createClass(MoiMir, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=moimir]'); - var share_url = 'http://connect.mail.ru/share?url=' + encodeURIComponent(this.url) + '&title=' + this.title + '&description=' + this.description + '&imageurl=' + this.image; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=moimir]'); + let share_url = 'http://connect.mail.ru/share?url=' + encodeURIComponent(this.url) + '&title=' + this.title + '&description=' + this.description + '&imageurl=' + this.image; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var this_url = encodeURIComponent(this.url.replace(/^.*?:\/\//, '')); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=moimir]'); - var count_url = 'https://appsmail.ru/share/count/' + this_url + '?callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.share_mm; - }); + getCounter() { + let script = document.createElement('script'); + let this_url = encodeURIComponent(this.url.replace(/^.*?:\/\//, '')); + let callback = ('goodshare_' + Math.random()).replace('.', ''); + let count_elements = document.querySelectorAll('[data-counter=moimir]'); + let count_url = 'https://appsmail.ru/share/count/' + this_url + '?callback=' + callback; + + if (count_elements.length > 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.share_mm; + }); - script.parentNode.removeChild(script); - }; + script.parentNode.removeChild(script); + }; - script.src = count_url; - document.body.appendChild(script); - } + script.src = count_url; + document.body.appendChild(script); } - }]); - - return MoiMir; -}(); + } +} -var moimir_share = exports.moimir_share = new MoiMir().shareWindow(); -var moimir_counter = exports.moimir_counter = new MoiMir().getCounter(); \ No newline at end of file +export let moimir_share = new MoiMir().shareWindow(); +export let moimir_counter = new MoiMir().getCounter(); \ No newline at end of file diff --git a/dist/providers/MyMailRu.js b/dist/providers/MyMailRu.js deleted file mode 100644 index 2a4b2450..00000000 --- a/dist/providers/MyMailRu.js +++ /dev/null @@ -1,85 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -/** - * Vikky Shostak - * Copyright (c) 2016 Koddr https://koddr.me - * http://opensource.org/licenses/MIT The MIT License (MIT) - * - * goodshare.js - * - * My @ Mail.Ru (https://my.mail.ru) provider. - */ - -var MyMailRu = function () { - function MyMailRu() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - var description = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.head.querySelector("meta[name=description]").content; - var image = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document.head.querySelector("link[rel=image_src]").href; - - _classCallCheck(this, MyMailRu); - - this.url = encodeURIComponent(url); - this.title = encodeURIComponent(title); - this.description = encodeURIComponent(description); - this.image = encodeURIComponent(image); - } - - _createClass(MyMailRu, [{ - key: "shareWindow", - value: function shareWindow() { - var share_url = 'http://connect.mail.ru/share?url=' + this.url + '&title=' + this.title + '&description=' + this.description + '&imageurl=' + this.image; - - document.body.querySelectorAll("[data-social=mymailru]").forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share window', 'width=400, height=400'); - }); - }); - } - }, { - key: "getCounter", - value: function getCounter() { - var page_url = this.url; - var count_url = 'https://connect.mail.ru/share_count?url_list=' + page_url; - - fetch(count_url, { method: 'GET', mode: 'cors' }).then(this.checkStatus).then(function (response) { - return response.json(); - }).then(function (counter) { - document.body.querySelectorAll("[data-counter=mymailru]").forEach(function (item) { - for (page_url in counter) { - if (counter.hasOwnProperty(page_url)) { - return item.innerHTML = counter[page_url].shares; - } - } - }); - }).catch(function (error) { - console.log('Request failed!', error); - }); - } - }], [{ - key: "checkStatus", - value: function checkStatus(response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - var error = new Error(response.statusText); - error.response = response; - throw error; - } - } - }]); - - return MyMailRu; -}(); - -var mymailru_share = exports.mymailru_share = new MyMailRu().shareWindow(); -var mymailru_counter = exports.mymailru_counter = new MyMailRu().getCounter(); \ No newline at end of file diff --git a/dist/providers/Odnoklassniki.js b/dist/providers/Odnoklassniki.js index 005ff9bb..f0c074c4 100644 --- a/dist/providers/Odnoklassniki.js +++ b/dist/providers/Odnoklassniki.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,56 +8,45 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Odnoklassniki (https://ok.ru) provider. */ -var Odnoklassniki = function () { - function Odnoklassniki() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Odnoklassniki); - +class Odnoklassniki { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Odnoklassniki, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=odnoklassniki]'); - var share_url = 'https://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=' + this.url + '&st.comments=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=odnoklassniki]'); + let share_url = 'https://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=' + this.url + '&st.comments=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var count_elements = document.querySelectorAll('[data-counter=odnoklassniki]'); - var count_url = 'https://connect.ok.ru/dk?st.cmd=extLike&uid=1&ref=' + this.url; + }); + } - window.ODKL = {}; + getCounter() { + let script = document.createElement('script'); + let count_elements = document.querySelectorAll('[data-counter=odnoklassniki]'); + let count_url = 'https://connect.ok.ru/dk?st.cmd=extLike&uid=1&ref=' + this.url; - if (count_elements.length > 0) { - window.ODKL.updateCount = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter; - }); + window.ODKL = {}; - script.parentNode.removeChild(script); - }; + if (count_elements.length > 0) { + window.ODKL.updateCount = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter; + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return Odnoklassniki; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var odnoklassniki_share = exports.odnoklassniki_share = new Odnoklassniki().shareWindow(); -var odnoklassniki_counter = exports.odnoklassniki_counter = new Odnoklassniki().getCounter(); \ No newline at end of file +export let odnoklassniki_share = new Odnoklassniki().shareWindow(); +export let odnoklassniki_counter = new Odnoklassniki().getCounter(); \ No newline at end of file diff --git a/dist/providers/Pinterest.js b/dist/providers/Pinterest.js index d32c1e04..6aca4f3c 100644 --- a/dist/providers/Pinterest.js +++ b/dist/providers/Pinterest.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,56 +8,44 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Pinterest (https://pinterest.com) provider. */ -var Pinterest = function () { - function Pinterest() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var description = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.querySelector('meta[name=description]'); - var image = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.querySelector('link[rel=image_src]'); - - _classCallCheck(this, Pinterest); - +class Pinterest { + constructor(url = document.location.href, description = document.querySelector('meta[name=description]'), image = document.querySelector('link[rel=image_src]')) { this.url = encodeURIComponent(url); this.description = description ? encodeURIComponent(description.content) : ''; this.image = image ? encodeURIComponent(image.href) : ''; } - _createClass(Pinterest, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=pinterest]'); - var share_url = 'https://www.pinterest.com/pin/create/button/?url=' + this.url + '&description=' + this.description + '&media=' + this.image; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=pinterest]'); + let share_url = 'https://www.pinterest.com/pin/create/button/?url=' + this.url + '&description=' + this.description + '&media=' + this.image; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var count_elements = document.querySelectorAll('[data-counter=pinterest]'); - var count_url = 'https://api.pinterest.com/v1/urls/count.json?callback=receiveCount&url=' + this.url; + }); + } - if (count_elements.length > 0) { - window['receiveCount'] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.length > 0 ? counter.count : 0; - }); + getCounter() { + let script = document.createElement('script'); + let count_elements = document.querySelectorAll('[data-counter=pinterest]'); + let count_url = 'https://api.pinterest.com/v1/urls/count.json?callback=receiveCount&url=' + this.url; - script.parentNode.removeChild(script); - }; + if (count_elements.length > 0) { + window['receiveCount'] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.length > 0 ? counter.count : 0; + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return Pinterest; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var pinterest_share = exports.pinterest_share = new Pinterest().shareWindow(); -var pinterest_counter = exports.pinterest_counter = new Pinterest().getCounter(); \ No newline at end of file +export let pinterest_share = new Pinterest().shareWindow(); +export let pinterest_counter = new Pinterest().getCounter(); \ No newline at end of file diff --git a/dist/providers/Pocket.js b/dist/providers/Pocket.js index e416d20f..0ae4602b 100644 --- a/dist/providers/Pocket.js +++ b/dist/providers/Pocket.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,55 +8,44 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Pocket (https://getpocket.com) provider. */ -var Pocket = function () { - function Pocket() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Pocket); - +class Pocket { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Pocket, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=pocket]'); - var share_url = 'https://getpocket.com/save?url=' + this.url + '&title=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=pocket]'); + let share_url = 'https://getpocket.com/save?url=' + this.url + '&title=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=pocket]'); - var count_url = 'https://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="https://widgets.getpocket.com/v1/button?count=horizontal&url=' + this.url + '" and xpath="*"') + '&callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.results.length > 0 ? counter.results[0].match(/em id="cnt">(\d+) 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.results.length > 0 ? counter.results[0].match(/em id="cnt">(\d+) * Copyright (c) 2016 Koddr https://koddr.me @@ -20,31 +8,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Readability (https://readability.com) provider. */ -var Readability = function () { - function Readability() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - - _classCallCheck(this, Readability); - +class Readability { + constructor(url = document.location.href) { this.url = encodeURIComponent(url); } - _createClass(Readability, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=readability]'); - var share_url = 'http://www.readability.com/save?url=' + this.url; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=readability]'); + let share_url = 'http://www.readability.com/save?url=' + this.url; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Readability; -}(); + }); + } +} -var readability_share = exports.readability_share = new Readability().shareWindow(); \ No newline at end of file +export let readability_share = new Readability().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Reddit.js b/dist/providers/Reddit.js index a8d64ea4..719a57ec 100644 --- a/dist/providers/Reddit.js +++ b/dist/providers/Reddit.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,65 +8,54 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Reddit (https://reddit.com) provider. */ -var Reddit = function () { - function Reddit() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Reddit); - +class Reddit { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Reddit, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=reddit]'); - var share_url = 'https://reddit.com/submit?url=' + this.url + '&title=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=reddit]'); + let share_url = 'https://reddit.com/submit?url=' + this.url + '&title=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=reddit]'); - var count_url = 'https://www.reddit.com/api/info.json?url=' + this.url + '&jsonp=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - if (counter.data.children.length > 0) { - var total_count = 0; + getCounter() { + let script = document.createElement('script'); + let callback = ('goodshare_' + Math.random()).replace('.', ''); + let count_elements = document.querySelectorAll('[data-counter=reddit]'); + let count_url = 'https://www.reddit.com/api/info.json?url=' + this.url + '&jsonp=' + callback; - for (var i = 0; i < counter.data.children.length; i++) { - total_count += counter.data.children[i].data.score; - } + if (count_elements.length > 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + if (counter.data.children.length > 0) { + let total_count = 0; - item.innerHTML = total_count; - } else { - item.innerHTML = 0; + for (let i = 0; i < counter.data.children.length; i++) { + total_count += counter.data.children[i].data.score; } - }); - script.parentNode.removeChild(script); - }; + item.innerHTML = total_count; + } else { + item.innerHTML = 0; + } + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return Reddit; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var reddit_share = exports.reddit_share = new Reddit().shareWindow(); -var reddit_counter = exports.reddit_counter = new Reddit().getCounter(); \ No newline at end of file +export let reddit_share = new Reddit().shareWindow(); +export let reddit_counter = new Reddit().getCounter(); \ No newline at end of file diff --git a/dist/providers/RenRen.js b/dist/providers/RenRen.js index e00d7035..e329d273 100644 --- a/dist/providers/RenRen.js +++ b/dist/providers/RenRen.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,33 +8,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * RenRen (https://renren.com) provider. */ -var RenRen = function () { - function RenRen() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, RenRen); - +class RenRen { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(RenRen, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=renren]'); - var share_url = 'http://share.renren.com/share/buttonshare.do?url=' + this.url + '&title=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=renren]'); + let share_url = 'http://share.renren.com/share/buttonshare.do?url=' + this.url + '&title=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return RenRen; -}(); + }); + } +} -var renren_share = exports.renren_share = new RenRen().shareWindow(); \ No newline at end of file +export let renren_share = new RenRen().shareWindow(); \ No newline at end of file diff --git a/dist/providers/StumbleUpon.js b/dist/providers/StumbleUpon.js index 09d1d8f9..c2efd1f5 100644 --- a/dist/providers/StumbleUpon.js +++ b/dist/providers/StumbleUpon.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,55 +8,44 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * StumbleUpon (https://stumbleupon.com) provider. */ -var StumbleUpon = function () { - function StumbleUpon() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, StumbleUpon); - +class StumbleUpon { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(StumbleUpon, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=stumbleupon]'); - var share_url = 'https://stumbleupon.com/submit?url=' + this.url + '&title=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=stumbleupon]'); + let share_url = 'https://stumbleupon.com/submit?url=' + this.url + '&title=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=stumbleupon]'); - var count_url = 'https://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="http://www.stumbleupon.com/services/1.01/badge.getinfo?url=' + this.url + '" and xpath="*"') + '&callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.results[0].match(/"views":(\d+),/) != null ? counter.results[0].match(/"views":(\d+),/)[1] / 1 : 0; - }); + getCounter() { + let script = document.createElement('script'); + let callback = ('goodshare_' + Math.random()).replace('.', ''); + let count_elements = document.querySelectorAll('[data-counter=stumbleupon]'); + let count_url = 'https://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="http://www.stumbleupon.com/services/1.01/badge.getinfo?url=' + this.url + '" and xpath="*"') + '&callback=' + callback; - script.parentNode.removeChild(script); - }; + if (count_elements.length > 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.results[0].match(/"views":(\d+),/) != null ? counter.results[0].match(/"views":(\d+),/)[1] / 1 : 0; + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return StumbleUpon; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var stumbleupon_share = exports.stumbleupon_share = new StumbleUpon().shareWindow(); -var stumbleupon_counter = exports.stumbleupon_counter = new StumbleUpon().getCounter(); \ No newline at end of file +export let stumbleupon_share = new StumbleUpon().shareWindow(); +export let stumbleupon_counter = new StumbleUpon().getCounter(); \ No newline at end of file diff --git a/dist/providers/Surfingbird.js b/dist/providers/Surfingbird.js index 79a991f8..3ec77144 100644 --- a/dist/providers/Surfingbird.js +++ b/dist/providers/Surfingbird.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,57 +8,45 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Surfingbird (https://surfingbird.ru) provider. */ -var Surfingbird = function () { - function Surfingbird() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - var description = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.querySelector('meta[name=description]'); - - _classCallCheck(this, Surfingbird); - +class Surfingbird { + constructor(url = document.location.href, title = document.title, description = document.querySelector('meta[name=description]')) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); this.description = description ? encodeURIComponent(description.content) : ''; } - _createClass(Surfingbird, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=surfingbird]'); - var share_url = 'https://surfingbird.ru/share?url=' + this.url + '&title=' + this.title + '&description=' + this.description; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=surfingbird]'); + let share_url = 'https://surfingbird.ru/share?url=' + this.url + '&title=' + this.title + '&description=' + this.description; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=surfingbird]'); - var count_url = 'https://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="https://surfingbird.ru/button?url=' + this.url + '" and xpath="*"') + '&callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.results.length > 0 ? counter.results[0].match(/span class="stats-num">(\d+) 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.results.length > 0 ? counter.results[0].match(/span class="stats-num">(\d+) * Copyright (c) 2016 Koddr https://koddr.me @@ -20,31 +8,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Telegram (https://telegram.org) provider. */ -var Telegram = function () { - function Telegram() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - - _classCallCheck(this, Telegram); - +class Telegram { + constructor(url = document.location.href) { this.url = encodeURIComponent(url); } - _createClass(Telegram, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=telegram]'); - var share_url = 'https://telegram.me/share/url?url=' + this.url; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=telegram]'); + let share_url = 'https://telegram.me/share/url?url=' + this.url; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Telegram; -}(); + }); + } +} -var telegram_share = exports.telegram_share = new Telegram().shareWindow(); \ No newline at end of file +export let telegram_share = new Telegram().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Tumblr.js b/dist/providers/Tumblr.js index 783190f7..1ec695c9 100644 --- a/dist/providers/Tumblr.js +++ b/dist/providers/Tumblr.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,57 +8,45 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Tumblr (https://tumblr.com) provider. */ -var Tumblr = function () { - function Tumblr() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - var description = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.querySelector('meta[name=description]'); - - _classCallCheck(this, Tumblr); - +class Tumblr { + constructor(url = document.location.href, title = document.title, description = document.querySelector('meta[name=description]')) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); this.description = description ? encodeURIComponent(description.content) : ''; } - _createClass(Tumblr, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=tumblr]'); - var share_url = 'https://www.tumblr.com/widgets/share/tool?canonicalUrl=' + this.url + '&title=' + this.title + '&caption=' + this.description + '&posttype=link'; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=tumblr]'); + let share_url = 'https://www.tumblr.com/widgets/share/tool?canonicalUrl=' + this.url + '&title=' + this.title + '&caption=' + this.description + '&posttype=link'; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=tumblr]'); - var count_url = 'https://api.tumblr.com/v2/share/stats?url=' + this.url + '&callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.response.note_count; - }); + getCounter() { + let script = document.createElement('script'); + let callback = ('goodshare_' + Math.random()).replace('.', ''); + let count_elements = document.querySelectorAll('[data-counter=tumblr]'); + let count_url = 'https://api.tumblr.com/v2/share/stats?url=' + this.url + '&callback=' + callback; - script.parentNode.removeChild(script); - }; + if (count_elements.length > 0) { + window[callback] = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter.response.note_count; + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return Tumblr; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var tumblr_share = exports.tumblr_share = new Tumblr().shareWindow(); -var tumblr_counter = exports.tumblr_counter = new Tumblr().getCounter(); \ No newline at end of file +export let tumblr_share = new Tumblr().shareWindow(); +export let tumblr_counter = new Tumblr().getCounter(); \ No newline at end of file diff --git a/dist/providers/Twitter.js b/dist/providers/Twitter.js index 52f9b60d..4410121c 100644 --- a/dist/providers/Twitter.js +++ b/dist/providers/Twitter.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,33 +8,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Twitter (https://twitter.com) provider. */ -var Twitter = function () { - function Twitter() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Twitter); - +class Twitter { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Twitter, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=twitter]'); - var share_url = 'http://twitter.com/share?url=' + this.url + '&text=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=twitter]'); + let share_url = 'http://twitter.com/share?url=' + this.url + '&text=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Twitter; -}(); + }); + } +} -var twitter_share = exports.twitter_share = new Twitter().shareWindow(); \ No newline at end of file +export let twitter_share = new Twitter().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Viber.js b/dist/providers/Viber.js index a57c5434..3c02d73c 100644 --- a/dist/providers/Viber.js +++ b/dist/providers/Viber.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,31 +8,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Viber (https://viber.com) provider. */ -var Viber = function () { - function Viber() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - - _classCallCheck(this, Viber); - +class Viber { + constructor(url = document.location.href) { this.url = encodeURIComponent(url); } - _createClass(Viber, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=viber]'); - var share_url = 'viber://forward?text=' + this.url; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=viber]'); + let share_url = 'viber://forward?text=' + this.url; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Viber; -}(); + }); + } +} -var viber_share = exports.viber_share = new Viber().shareWindow(); \ No newline at end of file +export let viber_share = new Viber().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Vkontakte.js b/dist/providers/Vkontakte.js index 58150ece..806f8b7e 100644 --- a/dist/providers/Vkontakte.js +++ b/dist/providers/Vkontakte.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,60 +8,47 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Vkontakte (https://vk.com) provider. */ -var Vkontakte = function () { - function Vkontakte() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - var description = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.querySelector('meta[name=description]'); - var image = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document.querySelector('link[rel=image_src]'); - - _classCallCheck(this, Vkontakte); - +class Vkontakte { + constructor(url = document.location.href, title = document.title, description = document.querySelector('meta[name=description]'), image = document.querySelector('link[rel=image_src]')) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); this.description = description ? encodeURIComponent(description.content) : ''; this.image = image ? encodeURIComponent(image.href) : ''; } - _createClass(Vkontakte, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=vkontakte]'); - var share_url = 'https://vk.com/share.php?url=' + this.url + '&title=' + this.title + '&description=' + this.description + '&image=' + this.image; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=vkontakte]'); + let share_url = 'https://vk.com/share.php?url=' + this.url + '&title=' + this.title + '&description=' + this.description + '&image=' + this.image; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var count_elements = document.querySelectorAll('[data-counter=vkontakte]'); - var count_url = 'https://vk.com/share.php?act=count&index=1&url=' + this.url; + }); + } - window.VK = { Share: {} }; + getCounter() { + let script = document.createElement('script'); + let count_elements = document.querySelectorAll('[data-counter=vkontakte]'); + let count_url = 'https://vk.com/share.php?act=count&index=1&url=' + this.url; - if (count_elements.length > 0) { - window.VK.Share.count = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter; - }); + window.VK = { Share: {} }; - script.parentNode.removeChild(script); - }; + if (count_elements.length > 0) { + window.VK.Share.count = counter => { + [...count_elements].forEach(item => { + item.innerHTML = counter; + }); - script.src = count_url; - document.body.appendChild(script); - } - } - }]); + script.parentNode.removeChild(script); + }; - return Vkontakte; -}(); + script.src = count_url; + document.body.appendChild(script); + } + } +} -var vkontakte_share = exports.vkontakte_share = new Vkontakte().shareWindow(); -var vkontakte_counter = exports.vkontakte_counter = new Vkontakte().getCounter(); \ No newline at end of file +export let vkontakte_share = new Vkontakte().shareWindow(); +export let vkontakte_counter = new Vkontakte().getCounter(); \ No newline at end of file diff --git a/dist/providers/Weibo.js b/dist/providers/Weibo.js index 3d90a321..52932c3a 100644 --- a/dist/providers/Weibo.js +++ b/dist/providers/Weibo.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,33 +8,23 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Weibo (http://weibo.com) provider. */ -var Weibo = function () { - function Weibo() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - - _classCallCheck(this, Weibo); - +class Weibo { + constructor(url = document.location.href, title = document.title) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); } - _createClass(Weibo, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=weibo]'); - var share_url = 'http://service.weibo.com/share/share.php?url=' + this.url + '&title=' + this.title; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=weibo]'); + let share_url = 'http://service.weibo.com/share/share.php?url=' + this.url + '&title=' + this.title; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return Weibo; -}(); + }); + } +} -var weibo_share = exports.weibo_share = new Weibo().shareWindow(); \ No newline at end of file +export let weibo_share = new Weibo().shareWindow(); \ No newline at end of file diff --git a/dist/providers/WhatsApp.js b/dist/providers/WhatsApp.js index 17c8154d..ade0b14a 100644 --- a/dist/providers/WhatsApp.js +++ b/dist/providers/WhatsApp.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,31 +8,22 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * WhatsApp (https://whatsapp.com) provider. */ -var WhatsApp = function () { - function WhatsApp() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - - _classCallCheck(this, WhatsApp); - +class WhatsApp { + constructor(url = document.location.href) { this.url = encodeURIComponent(url); } - _createClass(WhatsApp, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=whatsapp]'); - var share_url = 'whatsapp://send?text=' + this.url; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=whatsapp]'); + let share_url = 'whatsapp://send?text=' + this.url; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return WhatsApp; -}(); + }); + } +} -var whatsapp_share = exports.whatsapp_share = new WhatsApp().shareWindow(); \ No newline at end of file +export let whatsapp_share = new WhatsApp().shareWindow(); \ No newline at end of file diff --git a/dist/providers/WordPress.js b/dist/providers/WordPress.js index f361dd21..8df51628 100644 --- a/dist/providers/WordPress.js +++ b/dist/providers/WordPress.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,37 +8,25 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * WordPress (https://wordpress.com) provider. */ -var WordPress = function () { - function WordPress() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.title; - var description = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document.querySelector('meta[name=description]'); - var image = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : document.querySelector('link[rel=image_src]'); - - _classCallCheck(this, WordPress); - +class WordPress { + constructor(url = document.location.href, title = document.title, description = document.querySelector('meta[name=description]'), image = document.querySelector('link[rel=image_src]')) { this.url = encodeURIComponent(url); this.title = encodeURIComponent(title); this.description = description ? encodeURIComponent(description.content) : ''; this.image = image ? encodeURIComponent(image.href) : ''; } - _createClass(WordPress, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=wordpress]'); - var share_url = 'https://wordpress.com/wp-admin/press-this.php?u=' + this.url + '&t=' + this.title + '&s=' + this.description + '&i=' + this.image + '&v=2'; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=wordpress]'); + let share_url = 'https://wordpress.com/wp-admin/press-this.php?u=' + this.url + '&t=' + this.title + '&s=' + this.description + '&i=' + this.image + '&v=2'; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }]); - - return WordPress; -}(); + }); + } +} -var wordpress_share = exports.wordpress_share = new WordPress().shareWindow(); \ No newline at end of file +export let wordpress_share = new WordPress().shareWindow(); \ No newline at end of file diff --git a/dist/providers/Xing.js b/dist/providers/Xing.js index e10aec68..a026d752 100644 --- a/dist/providers/Xing.js +++ b/dist/providers/Xing.js @@ -1,15 +1,3 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - /** * Vikky Shostak * Copyright (c) 2016 Koddr https://koddr.me @@ -20,53 +8,43 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * Xing (https://xing.com) provider. */ -var Xing = function () { - function Xing() { - var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.location.href; - - _classCallCheck(this, Xing); - +class Xing { + constructor(url = document.location.href) { this.url = encodeURIComponent(url); } - _createClass(Xing, [{ - key: 'shareWindow', - value: function shareWindow() { - var share_elements = document.querySelectorAll('[data-social=xing]'); - var share_url = 'https://www.xing.com/spi/shares/new?url=' + this.url; + shareWindow() { + let share_elements = document.querySelectorAll('[data-social=xing]'); + let share_url = 'https://www.xing.com/spi/shares/new?url=' + this.url; - [].concat(_toConsumableArray(share_elements)).forEach(function (item) { - item.addEventListener('click', function (event) { - event.preventDefault(); - return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); - }); + [...share_elements].forEach(item => { + item.addEventListener('click', function (event) { + event.preventDefault(); + return window.open(share_url, 'Share this', 'width=640,height=480,location=no,toolbar=no,menubar=no'); }); - } - }, { - key: 'getCounter', - value: function getCounter() { - var script = document.createElement('script'); - var callback = ('goodshare_' + Math.random()).replace('.', ''); - var count_elements = document.querySelectorAll('[data-counter=xing]'); - var count_url = 'https://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="https://www.xing-share.com/app/share?op=get_share_button;counter=top;url=' + this.url + '" and xpath="*"') + '&callback=' + callback; + }); + } - if (count_elements.length > 0) { - window[callback] = function (counter) { - [].concat(_toConsumableArray(count_elements)).forEach(function (item) { - item.innerHTML = counter.results.length > 0 ? counter.results[0].match(/span class="xing-count top">(\d+) 0) { + window[callback] = counter => { + [...count_elements].forEach(function (item) { + item.innerHTML = counter.results.length > 0 ? counter.results[0].match(/span class="xing-count top">(\d+)