Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sharelinks

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sharelinks - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

bower.json
{
"name": "sharelinks",
"version": "1.0.0",
"version": "1.0.1",
"authors": [

@@ -5,0 +5,0 @@ "Mr Chimp <chimpytk@gmail.com>"

@@ -56,13 +56,17 @@ (function (root, factory) {

function findImage() {
var image = document.querySelector('meta[property="og:image"]').getAttribute('content');
var image = '';
if (!image) {
images = document.getElementsByTagName('img');
var og_image = document.querySelector('meta[property="og:image"]');
if (og_image) {
image = og_image.getAttribute('content');
} else {
var images = document.getElementsByTagName('img');
if (images.length > 0) {
image = iamges[0].getAttribute('src');
image = images[0].getAttribute('src');
}
}
return image || '';
return image;
}

@@ -69,0 +73,0 @@

@@ -1,1 +0,1 @@

(function(root,factory){if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof module==="object"&&module.exports){module.exports=factory()}else{root.sharelinks=factory()}})(this,function(){var platforms={facebook:{href:"https://www.facebook.com/sharer/sharer.php?u=%URL%",width:400,height:500},twitter:{href:"https://twitter.com/intent/tweet?status=%TITLE%+-+%URL%",width:540,height:260},tumblr:{href:"http://www.tumblr.com/share/link?url=%URL%",width:500,height:500},google:{href:"https://plus.google.com/share?url=%URL%",width:600,height:600},linkedin:{href:"http://www.linkedin.com/shareArticle?mini=true&amp;url=%URL%&amp;title=%TITLE%",width:520,height:570},pinterest:{href:"http://pinterest.com/pin/create/button/?url=%URL%&description=%TITLE%&media=%IMAGE%",width:520,height:570}};var elements;return function(selector){elements=document.querySelectorAll(selector);function makeLink(platform,url,title,image){return platform.href.replace("%URL%",encodeURIComponent(url).replace(/%20/g,"+")).replace("%TITLE%",encodeURIComponent(title).replace(/%20/g,"+")).replace("%IMAGE%",encodeURIComponent(image).replace(/%20/g,"+"))}function findImage(){var image=document.querySelector('meta[property="og:image"]').getAttribute("content");if(!image){images=document.getElementsByTagName("img");if(images.length>0){image=iamges[0].getAttribute("src")}}return image||""}function handleClick(e){if(e.which==1){e.preventDefault();var width,height,image,href,platform=platforms[e.target.dataset["platform"]]||false,elem=e.target;if(typeof platform==="undefined"){throw"Sharelinks Error: Invalid data-platform: "+$(this).data("platform")}width=elem.dataset.width||platform.width;height=elem.dataset.height||platform.height;image=elem.dataset.image||findImage();if(elem.dataset.url){href=makeLink(platform,elem.dataset.url,elem.dataset.title,image)}else{href=elem.getAttribute("href")}window.open(href,"","status=yes, width="+width+", height="+height)}}elements.forEach(function(element){var share_url,dest,title,image,platform=platforms[element.dataset.platform]||false;if(!platform){if(typeof console.error==="function"){console.error("Sharelinks Error: Invalid data-platform: "+element.dataset.platform)}}else{dest=element.dataset.url||window.location.href;title=element.dataset.title||document.title;image=element.dataset.image||findImage();share_url=makeLink(platform,dest,title,image);element.setAttribute("href",share_url);if(element.addEventListener){element.addEventListener("click",handleClick,false)}else{element.attachEvent("onclick",handleClick)}}})}});
(function(root,factory){if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof module==="object"&&module.exports){module.exports=factory()}else{root.sharelinks=factory()}})(this,function(){var platforms={facebook:{href:"https://www.facebook.com/sharer/sharer.php?u=%URL%",width:400,height:500},twitter:{href:"https://twitter.com/intent/tweet?status=%TITLE%+-+%URL%",width:540,height:260},tumblr:{href:"http://www.tumblr.com/share/link?url=%URL%",width:500,height:500},google:{href:"https://plus.google.com/share?url=%URL%",width:600,height:600},linkedin:{href:"http://www.linkedin.com/shareArticle?mini=true&amp;url=%URL%&amp;title=%TITLE%",width:520,height:570},pinterest:{href:"http://pinterest.com/pin/create/button/?url=%URL%&description=%TITLE%&media=%IMAGE%",width:520,height:570}};var elements;return function(selector){elements=document.querySelectorAll(selector);function makeLink(platform,url,title,image){return platform.href.replace("%URL%",encodeURIComponent(url).replace(/%20/g,"+")).replace("%TITLE%",encodeURIComponent(title).replace(/%20/g,"+")).replace("%IMAGE%",encodeURIComponent(image).replace(/%20/g,"+"))}function findImage(){var og_image=document.querySelector('meta[property="og:image"]');var image="";if(og_image){image=og_image.getAttribute("content")}else{var images=document.getElementsByTagName("img");if(images.length>0){image=images[0].getAttribute("src")}}return image}function handleClick(e){if(e.which==1){e.preventDefault();var width,height,image,href,platform=platforms[e.target.dataset["platform"]]||false,elem=e.target;if(typeof platform==="undefined"){throw"Sharelinks Error: Invalid data-platform: "+$(this).data("platform")}width=elem.dataset.width||platform.width;height=elem.dataset.height||platform.height;image=elem.dataset.image||findImage();if(elem.dataset.url){href=makeLink(platform,elem.dataset.url,elem.dataset.title,image)}else{href=elem.getAttribute("href")}window.open(href,"","status=yes, width="+width+", height="+height)}}elements.forEach(function(element){var share_url,dest,title,image,platform=platforms[element.dataset.platform]||false;if(!platform){if(typeof console.error==="function"){console.error("Sharelinks Error: Invalid data-platform: "+element.dataset.platform)}}else{dest=element.dataset.url||window.location.href;title=element.dataset.title||document.title;image=element.dataset.image||findImage();share_url=makeLink(platform,dest,title,image);element.setAttribute("href",share_url);if(element.addEventListener){element.addEventListener("click",handleClick,false)}else{element.attachEvent("onclick",handleClick)}}})}});
{
"name": "sharelinks",
"version": "1.0.0",
"version": "1.0.1",
"repository": "git@github.com/mrchimp/sharelinks",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc