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ATjC,EAAmB,CACnB,IAAMkC,EAAO,CACThE,MAAO4D,EAAK5D,MACZD,YAAa6D,EAAK7D,YAClBD,IAAK8D,EAAK9D,KAGd,IACIkC,UAAUC,MAAM+B,EACpB,CAAE,MAAOF,GACD5B,SAAWA,QAAQ+B,OACnB/B,QAAQ+B,MAAMH,EAEtB,CACJ,MACIb,OAAOiB,KAAK7B,EAAII,KAAM,YAAa,4DAAFL,QAA+D+B,OAAOC,OAAS,KAAO,EAAC,UAAAhC,QAAU+B,OAAOE,MAAQ,KAAO,GAEhK,GACJ,KAAC3E,CAAA,CAhOqB,ICEL4E,EAAe,WAChC,SAAAA,KAAc1E,EAAAA,EAAAA,GAAA,KAAA0E,GACVzE,KAAK0E,SAAW,kBAChB1E,KAAK2E,UAAY,GAEjB3E,KAAK4E,MACT,CAWC,OAXAxD,EAAAA,EAAAA,GAAAqD,EAAA,EAAApD,IAAA,OAAAC,MAED,WAAO,IAAAM,EAAA,KACCa,SAASoC,iBAAiB7E,KAAK0E,UAAUd,QACzCnB,SAASoC,iBAAiB7E,KAAK0E,UAAU1C,SAAQ,SAAAlC,GAC7C,IAAMsC,EAAQ,IAAIvC,EAAMC,GACxB8B,EAAK+C,UAAUG,KAAK1C,GAEpBA,EAAMwC,MACV,GAER,KAACH,CAAA,CAjB+B,E","sources":["webpack://something_big_project/./scripts/controllers/share/share.js","webpack://something_big_project/./scripts/controllers/share/controller.js"],"sourcesContent":["export default class Share {\r\n constructor(container) {\r\n this.container = container;\r\n\r\n this.url = null;\r\n this.description = null;\r\n this.title = null;\r\n this.tagTitle = 'Delen via MEDIA';\r\n this.mobile = false;\r\n\r\n this.nativeShare = false;\r\n\r\n this.order = [\r\n 'facebook',\r\n 'linkedin',\r\n 'twitter',\r\n 'native',\r\n 'whatsapp',\r\n 'telegram',\r\n 'email',\r\n ];\r\n\r\n this.medias = {\r\n twitter: {\r\n name: 'Twitter',\r\n enabled: true,\r\n icon: '',\r\n mobileOnly: false,\r\n },\r\n linkedin: {\r\n name: 'LinkedIn',\r\n enabled: true,\r\n icon: '',\r\n mobileOnly: false,\r\n },\r\n facebook: {\r\n name: 'Facebook',\r\n enabled: true,\r\n icon: '',\r\n mobileOnly: false,\r\n },\r\n email: {\r\n name: 'e-mail',\r\n enabled: false,\r\n icon: '',\r\n mobileOnly: false,\r\n },\r\n whatsapp: {\r\n name: 'WhatsApp',\r\n enabled: true,\r\n icon: '',\r\n mobileOnly: false,\r\n },\r\n telegram: {\r\n name: 'Telegram',\r\n enabled: true,\r\n icon: ``,\r\n mobileOnly: false,\r\n },\r\n native: {\r\n name: 'Share',\r\n enabled: false,\r\n tagTitle: 'Delen',\r\n icon: '',\r\n mobileOnly: false,\r\n },\r\n };\r\n }\r\n\r\n init() {\r\n this.mobile = this.detectMobile();\r\n this.url = this.obtainUrl();\r\n this.description = this.obtainDescription();\r\n this.title = this.obtainTitle();\r\n\r\n this.createShareButtons();\r\n }\r\n\r\n createShareButtons() {\r\n let list = Object.keys(this.medias);\r\n\r\n if (this.order) {\r\n list = this.order;\r\n }\r\n list.forEach(media => {\r\n if (this.medias[media].enabled) {\r\n let render = true;\r\n if (this.medias[media].mobileOnly && !this.mobile) {\r\n render = false;\r\n }\r\n\r\n if (media == 'native' && !navigator.share) {\r\n render = false;\r\n }\r\n\r\n console.log(`${media}: ${render}`);\r\n\r\n if (render) {\r\n const tag = document.createElement('a');\r\n tag.setAttribute('target', '_blank');\r\n tag.setAttribute('rel', 'noopener');\r\n tag.href = this[media]();\r\n if (this.medias[media].tagTitle) {\r\n tag.title = this.medias[media].tagTitle;\r\n } else {\r\n tag.title = this.tagTitle.replace(/MEDIA/g, this.medias[media].name);\r\n }\r\n tag.innerHTML = this.medias[media].icon;\r\n\r\n this.bindEvents(tag, media);\r\n this.container.appendChild(tag);\r\n }\r\n }\r\n });\r\n }\r\n\r\n detectMobile() {\r\n return /iPhone|Android|Blackberry/i.test(navigator.userAgent);\r\n }\r\n\r\n obtainUrl() {\r\n if (this.container.dataset.url) {\r\n return this.container.dataset.url;\r\n }\r\n\r\n return window.location.href;\r\n }\r\n\r\n obtainDescription() {\r\n if (this.container.dataset.description) {\r\n return this.container.dataset.description;\r\n }\r\n \r\n let metaDescription = null;\r\n let ogDescription = null;\r\n let metaTags = document.head.getElementsByTagName('meta');\r\n\r\n for (let metaIndex = 0; metaIndex < metaTags.length; metaIndex++) {\r\n if (metaTags[metaIndex].getAttribute('property') === 'description') {\r\n metaDescription = metaTags[metaIndex].getAttribute('content');\r\n }\r\n if (metaTags[metaIndex].getAttribute('property') === 'og:description') {\r\n ogDescription = metaTags[metaIndex].getAttribute('content');\r\n }\r\n }\r\n\r\n if (metaDescription === null && ogDescription === null) {\r\n return '';\r\n } \r\n \r\n if (ogDescription !== null) {\r\n return ogDescription;\r\n }\r\n\r\n return metaDescription;\r\n }\r\n\r\n obtainTitle() {\r\n if (this.container.dataset.title) {\r\n return this.container.dataset.title;\r\n }\r\n\r\n return document.title;\r\n }\r\n\r\n obtainTagTitle(media) {\r\n if (this.container.dataset.tagTitle) {\r\n return this.container.dataset.tagTitle.replace(`MEDIA`, this.medias[media].name);\r\n }\r\n\r\n return `Deel via ${this.medias[media].name}`;\r\n }\r\n\r\n // Social media specific methods\r\n twitter() {\r\n return `https://twitter.com/intent/tweet?url=${encodeURIComponent(this.url)}&text=${encodeURIComponent(this.description)}`;\r\n }\r\n\r\n linkedin() {\r\n return `https://www.linkedin.com/shareArticle?url=${encodeURIComponent(this.url)}&mini=true&summary=${encodeURIComponent(this.description)}`\r\n }\r\n \r\n facebook() {\r\n return `https://www.facebook.com/sharer.php?u=${encodeURIComponent(this.url)}`;\r\n }\r\n \r\n email() {\r\n return `mailto:?body=${encodeURIComponent(this.url) + ' ' + this.description}&subject=Ik heb een interessante pagina gevonden: ${this.title}`;\r\n }\r\n\r\n whatsapp() {\r\n return `https://wa.me?text=${encodeURIComponent(this.url)}`;\r\n }\r\n\r\n telegram() {\r\n return `https://t.me/share/url?url=${encodeURIComponent(this.url)}&text=${this.description}`;\r\n }\r\n\r\n native() {\r\n return 'javascript:void(0);';\r\n }\r\n\r\n bindEvents(tag, media) {\r\n tag.addEventListener('click', e => {\r\n e.preventDefault();\r\n\r\n if (media == 'native') {\r\n const data = {\r\n title: this.title,\r\n description: this.description,\r\n url: this.url\r\n };\r\n\r\n try {\r\n navigator.share(data);\r\n } catch (e) {\r\n if (console && console.error) {\r\n console.error(e);\r\n }\r\n }\r\n } else {\r\n window.open(tag.href, 'NewWindow', `menubar=no,toolbar=no,status=no,width=570,height=570,top=${(screen.height - 570) / 2},left=${(screen.width - 570) / 2}`);\r\n }\r\n });\r\n }\r\n}","import Share from './share';\r\n\r\nexport default class ShareController {\r\n constructor() {\r\n this.selector = '.shareContainer';\r\n this.instances = [];\r\n\r\n this.init();\r\n }\r\n\r\n init() {\r\n if (document.querySelectorAll(this.selector).length) {\r\n document.querySelectorAll(this.selector).forEach(container => {\r\n const share = new Share(container);\r\n this.instances.push(share);\r\n\r\n share.init();\r\n })\r\n }\r\n }\r\n}"],"names":["Share","container","_classCallCheck","this","url","description","title","tagTitle","mobile","nativeShare","order","medias","twitter","name","enabled","icon","mobileOnly","linkedin","facebook","email","whatsapp","telegram","native","_createClass","key","value","detectMobile","obtainUrl","obtainDescription","obtainTitle","createShareButtons","_this","list","Object","keys","forEach","media","render","navigator","share","console","log","concat","tag","document","createElement","setAttribute","href","replace","innerHTML","bindEvents","appendChild","test","userAgent","dataset","window","location","metaDescription","ogDescription","metaTags","head","getElementsByTagName","metaIndex","length","getAttribute","encodeURIComponent","_this2","addEventListener","e","preventDefault","data","error","open","screen","height","width","ShareController","selector","instances","init","querySelectorAll","push"],"sourceRoot":""}