From f87046e5aef309d15ecbf9a3c2e14e57a33dbeaa Mon Sep 17 00:00:00 2001 From: James Warren Date: Fri, 4 Mar 2016 16:39:57 +0000 Subject: [PATCH] Release v0.2.2 --- CHANGELOG.md | 4 ++++ bower.json | 2 +- dist/angular-addthis.js | 13 ++++++++++++- dist/angular-addthis.min.js | 4 ++-- package.json | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d57912..859584b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Changes in 0.2.2 + + * @jamesjwarren: Fix: set share default title and description from document (#17) + ## Changes in 0.2.1 * @jamesjwarren: Fix: get share url from $location service (#14) diff --git a/bower.json b/bower.json index f4b76b2..26affc1 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "angular-addthis", "description": "Addthis toolbox directive, Re-renders addthis buttons as ngRoute changes views in our app since the addthis buttons only load by default on page load and not when the DOM is updated.", - "version": "0.2.1", + "version": "0.2.2", "homepage": "https://github.com/thisissoon/angular-addthis", "license": "MIT", "main": "dist/angular-addthis.js", diff --git a/dist/angular-addthis.js b/dist/angular-addthis.js index e4b0b38..b735ec1 100644 --- a/dist/angular-addthis.js +++ b/dist/angular-addthis.js @@ -1,4 +1,4 @@ -/*! angular-addthis - v0.2.1 - 2016-02-05 */ +/*! angular-addthis - v0.2.2 - 2016-03-04 */ "use strict"; /** * AddThis widget directive, Re-renders addthis buttons as angular changes @@ -107,6 +107,17 @@ angular.module("sn.addthis", []) } } + // Default share title from page title + if (!$scope.share.title) { + var titleElement = $document[0].querySelector("title"); + $scope.share.title = titleElement ? titleElement.innerHTML : ""; + } + // Default share description from page title + if (!$scope.share.description) { + var descElement = $document[0].querySelector("meta[name='description']"); + $scope.share.description = descElement ? descElement.getAttribute("content") : ""; + } + $window.addthis.init(); if ($window.addthis.layers && $window.addthis.layers.refresh) { diff --git a/dist/angular-addthis.min.js b/dist/angular-addthis.min.js index a18d896..c1a2069 100644 --- a/dist/angular-addthis.min.js +++ b/dist/angular-addthis.min.js @@ -1,2 +1,2 @@ -/*! angular-addthis - v0.2.1 - 2016-02-05 */ -!function(a){"use strict";angular.module("sn.addthis",[]).directive("snAddthisToolbox",["$document","$timeout","$window","$location",function(a,b,c,d){return{restrict:"EAC",replace:!1,scope:{share:"=?"},link:function(a,e){a.share=a.share?a.share:{},a.checksLeft=10,a.config=c.addthis_config?c.addthis_config:{},a.removeStockButtons=function(){if(a.checksLeft>0){a.checksLeft--;var c=e[0].getElementsByClassName("at-share-tbx-element")[0];c?c.parentNode.removeChild(c):(b.cancel(a.timer),a.timer=b(a.removeStockButtons,500))}},a.init=function(){a.share.url||(a.share.url=d.absUrl(),"/"===d.path()&&(a.share.url=a.share.url+"#/")),c.addthis.init(),c.addthis.layers&&c.addthis.layers.refresh&&c.addthis.layers.refresh(),c.addthis.toolbox(e[0],a.config,a.share),a.timer=b(a.removeStockButtons,500)},a.init()}}}])}(window); \ No newline at end of file +/*! angular-addthis - v0.2.2 - 2016-03-04 */ +!function(a){"use strict";angular.module("sn.addthis",[]).directive("snAddthisToolbox",["$document","$timeout","$window","$location",function(a,b,c,d){return{restrict:"EAC",replace:!1,scope:{share:"=?"},link:function(e,f){e.share=e.share?e.share:{},e.checksLeft=10,e.config=c.addthis_config?c.addthis_config:{},e.removeStockButtons=function(){if(e.checksLeft>0){e.checksLeft--;var a=f[0].getElementsByClassName("at-share-tbx-element")[0];a?a.parentNode.removeChild(a):(b.cancel(e.timer),e.timer=b(e.removeStockButtons,500))}},e.init=function(){if(e.share.url||(e.share.url=d.absUrl(),"/"===d.path()&&(e.share.url=e.share.url+"#/")),!e.share.title){var g=a[0].querySelector("title");e.share.title=g?g.innerHTML:""}if(!e.share.description){var h=a[0].querySelector("meta[name='description']");e.share.description=h?h.getAttribute("content"):""}c.addthis.init(),c.addthis.layers&&c.addthis.layers.refresh&&c.addthis.layers.refresh(),c.addthis.toolbox(f[0],e.config,e.share),e.timer=b(e.removeStockButtons,500)},e.init()}}}])}(window); \ No newline at end of file diff --git a/package.json b/package.json index 8c7f241..c00c56a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "angular-addthis", "private": false, - "version": "0.2.1", + "version": "0.2.2", "description": "Addthis toolbox directive, Re-renders addthis buttons as ngRoute changes views in our app since the addthis buttons only load by default on page load and not when the DOM is updated.", "repository": "https://github.com/thisissoon/angular-utils", "license": "MIT",