├── .eslintrc ├── .gitignore ├── .jscsrc ├── Readme.md ├── assets └── js │ └── index.js ├── bower.json ├── conf ├── paths.js └── tasks │ ├── annotate.js │ ├── build.js │ ├── clean.js │ ├── lint.js │ ├── minify.js │ ├── move.js │ ├── serve.js │ └── watch.js ├── dist ├── angular-socialshare.js ├── angular-socialshare.js.map └── angular-socialshare.min.js ├── gulpfile.js ├── index.html ├── index.js ├── lib └── angular-socialshare.js └── package.json /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-cond-assign": 2, 4 | "no-constant-condition": 2, 5 | "comma-dangle": 2, 6 | "no-control-regex": 2, 7 | "no-debugger": 2, 8 | "no-dupe-keys": 2, 9 | "no-empty": 2, 10 | "no-extra-semi": 2, 11 | "no-inner-declarations": 2, 12 | "no-invalid-regexp": 2, 13 | "no-negated-in-lhs": 2, 14 | "no-obj-calls": 2, 15 | "no-regex-spaces": 2, 16 | "no-sparse-arrays": 2, 17 | "no-unreachable": 2, 18 | "use-isnan": 2, 19 | "valid-typeof": 2, 20 | "camelcase": 2, 21 | "eqeqeq": 2, 22 | "no-plusplus": 2, 23 | "no-bitwise": 2, 24 | "block-scoped-var": 2, 25 | "consistent-return": 2, 26 | "curly": [ 27 | 2, 28 | "all" 29 | ], 30 | "default-case": 2, 31 | "dot-notation": 2, 32 | "no-caller": 2, 33 | "no-div-regex": 2, 34 | "no-else-return": 2, 35 | "no-empty-label": 2, 36 | "no-eq-null": 2, 37 | "no-eval": 2, 38 | "no-extend-native": 2, 39 | "no-fallthrough": 2, 40 | "no-floating-decimal": 2, 41 | "no-implied-eval": 2, 42 | "no-labels": 2, 43 | "no-iterator": 2, 44 | "no-lone-blocks": 2, 45 | "no-loop-func": 2, 46 | "no-multi-str": 2, 47 | "no-native-reassign": 2, 48 | "no-new": 2, 49 | "no-new-func": 2, 50 | "no-new-wrappers": 2, 51 | "no-octal": 2, 52 | "no-octal-escape": 2, 53 | "no-proto": 2, 54 | "no-redeclare": 2, 55 | "no-return-assign": 2, 56 | "no-script-url": 2, 57 | "no-self-compare": 2, 58 | "no-sequences": 2, 59 | "no-unused-expressions": 2, 60 | "no-with": 2, 61 | "yoda": 2, 62 | "radix": 2, 63 | "wrap-iife": [ 64 | 2, 65 | "outside" 66 | ], 67 | "strict": [2, "never"], 68 | "no-catch-shadow": 2, 69 | "no-delete-var": 2, 70 | "no-label-var": 2, 71 | "no-shadow": 2, 72 | "no-shadow-restricted-names": 2, 73 | "no-undef": 2, 74 | "no-undef-init": 2, 75 | "no-unused-vars": [ 76 | 2, 77 | { 78 | "vars": "all", 79 | "args": "after-used" 80 | } 81 | ], 82 | "no-use-before-define": 2, 83 | "brace-style": [ 84 | 2, 85 | "1tbs" 86 | ], 87 | "consistent-this": [ 88 | 2, 89 | "that" 90 | ], 91 | "new-cap": 2, 92 | "new-parens": 2, 93 | "no-nested-ternary": 2, 94 | "no-array-constructor": 2, 95 | "no-lonely-if": 2, 96 | "no-new-object": 2, 97 | "no-spaced-func": 2, 98 | "semi-spacing": 2, 99 | "no-underscore-dangle": 2, 100 | // "no-extra-parens": 2, 101 | "quotes": [ 102 | 2, 103 | "single", 104 | "avoid-escape" 105 | ], 106 | "quote-props": 2, 107 | "semi": [ 108 | 2, 109 | "always" 110 | ], 111 | "space-after-keywords": [ 112 | 2, 113 | "always" 114 | ], 115 | "object-curly-spacing": [ 116 | 2, 117 | "never" 118 | ], 119 | "array-bracket-spacing": [ 120 | 2, 121 | "never" 122 | ], 123 | "computed-property-spacing": [ 124 | 2, 125 | "never" 126 | ], 127 | "space-infix-ops": 2, 128 | "space-return-throw-case": 2, 129 | "space-unary-ops": 2, 130 | "one-var": 2, 131 | "wrap-regex": 2, 132 | 133 | "no-extra-boolean-cast": 1, 134 | "no-console": 1, 135 | "no-alert": 1, 136 | "no-empty-character-class": 1, 137 | "no-ex-assign": 1, 138 | "no-func-assign": 1, 139 | "valid-jsdoc": 1, 140 | "guard-for-in": 1, 141 | "no-warning-comments": [ 142 | 1, 143 | { 144 | "terms": ["todo", "fixme", "xxx"], 145 | "location": "anywhere" 146 | } 147 | ], 148 | "func-style": [ 149 | 1, 150 | "expression" 151 | ], 152 | "no-extra-parens": 1, 153 | "func-names": 1, 154 | 155 | "no-ternary": 0, 156 | "sort-vars": 0 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .idea -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "validateIndentation": 2, 3 | "disallowAnonymousFunctions": true, 4 | "disallowCapitalizedComments": true, 5 | "disallowDanglingUnderscores": true, 6 | "disallowEmptyBlocks": true, 7 | "disallowFunctionDeclarations": true, 8 | "disallowImplicitTypeConversion": [ 9 | "numeric", 10 | "binary", 11 | "string" 12 | ], 13 | "disallowKeywordsOnNewLine": [ 14 | "else" 15 | ], 16 | "disallowKeywords": [ 17 | "with" 18 | ], 19 | "disallowMixedSpacesAndTabs": true, 20 | "disallowMultipleLineBreaks": true, 21 | "disallowMultipleLineStrings": true, 22 | "disallowMultipleSpaces": true, 23 | "disallowNewlineBeforeBlockStatements": true, 24 | "disallowNotOperatorsInConditionals": true, 25 | "disallowOperatorBeforeLineBreak": [ 26 | ".", 27 | "+" 28 | ], 29 | "disallowSpacesInCallExpression": true, 30 | "disallowYodaConditions": true, 31 | "requireBlocksOnNewline": true, 32 | "requireCurlyBraces": [ 33 | "if", 34 | "else", 35 | "for", 36 | "while", 37 | "do", 38 | "try", 39 | "catch", 40 | "case", 41 | "default" 42 | ], 43 | "requireDotNotation": true, 44 | "requireLineBreakAfterVariableAssignment": true, 45 | "requireLineFeedAtFileEnd": true, 46 | "requireMultipleVarDecl": true, 47 | "requireNamedUnassignedFunctions": true, 48 | "requireOperatorBeforeLineBreak": [ 49 | "?", 50 | "=", 51 | "+", 52 | "-", 53 | "/", 54 | "*", 55 | "==", 56 | "===", 57 | "!=", 58 | "!==", 59 | ">", 60 | ">=", 61 | "<", 62 | "<=" 63 | ], 64 | "requirePaddingNewLineAfterVariableDeclaration": true, 65 | "requirePaddingNewLinesAfterUseStrict": true, 66 | "requirePaddingNewLinesBeforeExport": true, 67 | "requirePaddingNewLinesInObjects": true, 68 | "requireParenthesesAroundIIFE": true, 69 | "requireQuotedKeysInObjects": true, 70 | "requireSpaceBetweenArguments": true, 71 | "requireSpacesInAnonymousFunctionExpression": { 72 | "beforeOpeningRoundBrace": true, 73 | "beforeOpeningCurlyBrace": true 74 | }, 75 | "requireSpacesInForStatement": true, 76 | "requireSpacesInFunctionDeclaration": { 77 | "beforeOpeningCurlyBrace": true 78 | }, 79 | "disallowSpacesInFunctionDeclaration": { 80 | "beforeOpeningRoundBrace": true 81 | }, 82 | "requireSpacesInFunctionExpression": { 83 | "beforeOpeningCurlyBrace": true 84 | }, 85 | "disallowSpacesInFunctionExpression": { 86 | "beforeOpeningRoundBrace": true 87 | }, 88 | "requireSpacesInFunction": { 89 | "beforeOpeningCurlyBrace": true 90 | }, 91 | "disallowSpacesInFunction": { 92 | "beforeOpeningRoundBrace": true 93 | }, 94 | "requireSpacesInNamedFunctionExpression": { 95 | "beforeOpeningCurlyBrace": true 96 | }, 97 | "disallowSpacesInNamedFunctionExpression": { 98 | "beforeOpeningRoundBrace": true 99 | }, 100 | "safeContextKeyword": [ 101 | "that" 102 | ], 103 | "validateAlignedFunctionParameters": { 104 | "lineBreakAfterOpeningBraces": true 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | Angular Socialshare 2 | ================== 3 | 4 | ![Angular socialshare](http://i.imgur.com/dvoeyBu.png) 5 | 6 | [![Join the chat at https://gitter.im/720kb/angular-socialshare](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/720kb/angular-socialshare?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 7 | 8 | 9 | Angular Socialshare is an angularjs directive for sharing urls and content on social networks such as (facebook, google+, twitter, pinterest and so on). 10 | 11 | 12 | The Angular Socialshare is developed by [720kb](http://720kb.net). 13 | 14 | #### Requirements 15 | 16 | 17 | AngularJS v1.3+ 18 | 19 | #### Browser support 20 | 21 | 22 | Chrome | Firefox | IE | Opera | Safari 23 | --- | --- | --- | --- | --- | 24 | ✔ | ✔ | IE9 + | ✔ | ✔ | 25 | 26 | 27 | ## Load 28 | 29 | To use the directive, include the angular socialshare's javascript file in your web page: 30 | 31 | ```html 32 | 33 | 34 | 35 | //..... 36 | 37 | 38 | 39 | ``` 40 | 41 | ## Installation 42 | 43 | 44 | #### Bower 45 | 46 | ```bash 47 | $ bower install angularjs-socialshare --save 48 | ``` 49 | #### npm 50 | 51 | ```bash 52 | $ npm install angular-socialshare --save 53 | ``` 54 | 55 | _then [load](https://github.com/720kb/angular-socialshare#load) it in your html_ 56 | 57 | #### Add module dependency 58 | Add the 720kb.socialshare module dependency 59 | 60 | ```javascript 61 | angular.module('app', [ 62 | '720kb.socialshare' 63 | ]); 64 | ``` 65 | 66 | Call the directive wherever you want in your html page 67 | 68 | ```html 69 | 75 | Share me 76 | 77 | ``` 78 | OR 79 | 80 | Call the Socialshare [service](#service) 81 | 82 | ```javascript 83 | .controller('Ctrl', ['Socialshare', function testController(Socialshare) { 84 | 85 | Socialshare.share({ 86 | 'provider': 'facebook', 87 | 'attrs': { 88 | 'socialshareUrl': 'http://720kb.net' 89 | } 90 | }); 91 | ``` 92 | 93 | 94 | ## Usage 95 | 96 | Angular socialshare allows you to use sharing options via `attribute` data 97 | 98 | #### Sharing Provider 99 | 100 | You can set the social platform you want to share on using the `socialshare-provider=""` attribute. 101 | 102 | ##### Providers: 103 | 104 | - [email](#email) 105 | - [facebook](#facebook) 106 | - [facebook-messenger](#facebook-messenger) 107 | - [twitter](#twitter) 108 | - [linkedin](#linkedin) 109 | - [google](#google-plus) 110 | - [pinterest](#pinterest) 111 | - [tumblr](#tumblr) 112 | - [reddit](#reddit) 113 | - [stumbleupon](#stumbleupon) 114 | - [buffer](#buffer) 115 | - [digg](#digg) 116 | - [delicious](#delicious) 117 | - [vk](#vk) 118 | - [ok](#vk) 119 | - [pocket](#pocket) 120 | - [wordpress](#wordpress) 121 | - [flipboard](#flipboard) 122 | - [xing](#xing) 123 | - [hackernews](#hacker-news) 124 | - [evernote](#evernote) 125 | - [whatsapp](#whatsapp) 126 | - [telegram](#telegram) 127 | - [viber](#viber) 128 | - [skype](#skype) 129 | - [sms](#sms) 130 | - [weibo](#weibo) 131 | 132 | Please use them all in lowercase (`socialshare-provider="delicious"`) 133 | 134 | ## Doc 135 | 136 | #### Facebook 137 | 138 | (`socialshare-provider="facebook"`) 139 | 140 | > As of April 2017 - If you want to share a photo and customize the previews you must use [Open Graph Metas](https://developers.facebook.com/docs/sharing/webmasters#markup) 141 | 142 | `simple sharer` = [Facebook simple share](https://developers.facebook.com/docs/plugins/share-button) , `share` = [Facebook Dialog Share](https://developers.facebook.com/docs/sharing/reference/share-dialog), `feed` = [Facebook Dialog Feed](https://developers.facebook.com/docs/sharing/reference/feed-dialog), `send` = [Facebook Dialog Send](https://developers.facebook.com/docs/sharing/reference/send-dialog) 143 | 144 | Method | Option | Type | Default | Description 145 | ------------- | ------------- | ------------- | ------------- | ------------- 146 | share, feed, send, **simple sharer**|socialshare-url=""|page URL|false|Set the url/link to share 147 | feed, send, share|socialshare-type=""|String('feed' or 'send' or 'share')|**simple sharer**|Use a **simple sharer** or Dialog Send or Dialog Share or Dialog Feed 148 | feed, send, share|socialshare-via=""|String|false|Set the FB APP ID value 149 | feed, send|socialshare-to=""|String|false|Set the to value 150 | feed | socialshare-from=""|String|false|Set the from to value 151 | feed, send|socialshare-ref=""|String('comma,separated')|false|Set the ref value 152 | feed, send, share|socialshare-display=""|String('popup')|false|Set the display value 153 | share|socialshare-quote=""|String|false|Set the display text 154 | share|socialshare-hashtags=""|String|false|Set the display value along with # Eg:#facebook (one only hashtag) 155 | feed|socialshare-source=""|URL|false| Set the URL of a media file (either SWF or MP3) attached to this post 156 | feed, send|socialshare-redirect-uri=""|URL|false|Set the redirect URI 157 | share|socialshare-mobileiframe=""|boolean|false|If set to true the share button will open the share dialog in an iframe on top of your website. This option is only available for mobile, not desktop. 158 | 159 | #### Facebook Messenger 160 | `mobile only` - (works only for `` elements, it is a direct link) 161 | 162 | (`socialshare-provider="facebook-messenger"`) 163 | 164 | Method | Option | Type | Default | Description 165 | ------------- | ------------- | ------------- | ------------- | ------------- 166 | sharer|socialshare-url=""|URL|page URL|Set the url to share 167 | 168 | 169 | #### Twitter 170 | 171 | (`socialshare-provider="twitter"`) 172 | 173 | Method | Option | Type | Default | Description 174 | ------------- | ------------- | ------------- | ------------- | ------------- 175 | sharer|socialshare-url=""|URL | page URL|Set the url to share 176 | sharer|socialshare-text=""|String|false|Set the content to share 177 | sharer|socialshare-via=""|String('username')|false|Set the via to share 178 | sharer|socialshare-hashtags=""|String('hash,tag,hastag')|false|Set the hashtags to share 179 | 180 | 181 | #### Linkedin 182 | 183 | (`socialshare-provider="linkedin"`) 184 | 185 | Method | Option | Type | Default | Description 186 | -------------|-------------|-------------|-------------|------------- 187 | sharer|socialshare-url=""|URL|pageURL|Set the url to share 188 | sharer|socialshare-text=""|String|false|Set the title value that you wish to use 189 | sharer|socialshare-description=""|String|false|Set the description value that you wish to use 190 | sharer|socialshare-source=""|String|false|Set the source of the content 191 | 192 | #### Reddit 193 | 194 | (`socialshare-provider="reddit"`) 195 | 196 | Method | Option | Type | Default | Description 197 | ------------- | ------------- | ------------- | ------------- | ------------- 198 | sharer|socialshare-url=""|URL|pageURL|Set the url to share 199 | sharer|socialshare-text=""|String|false|Set the text content to share 200 | sharer|socialshare-subreddit=""|String('technology')|false|Set the subreddit to share on 201 | 202 | #### Vk 203 | 204 | (`socialshare-provider="vk"`) 205 | 206 | Method | Option | Type | Default | Description 207 | ------------- | ------------- | ------------- | ------------- | ------------- 208 | sharer|socialshare-url=""|URL|page URL|Set the url to share 209 | sharer|socialshare-text=""|String|false|Set the title to share 210 | sharer|socialshare-description=""|String|false| Set the content to share 211 | sharer|socialshare-media=""|URL|false|Set the image source to share 212 | 213 | #### OK 214 | 215 | (ok.ru) 216 | 217 | (`socialshare-provider="ok"`) 218 | 219 | Method | Option | Type | Default | Description 220 | ------------- | ------------- | ------------- | ------------- | ------------- 221 | sharer|socialshare-url=""|URL|page URL|Set the url to share 222 | sharer|socialshare-text=""|String|false|Set the content to share 223 | 224 | #### Digg 225 | 226 | Method | Option | Type | Default | Description 227 | ------------- | ------------- | ------------- | ------------- | ------------- 228 | sharer|socialshare-url=""|URL|page URL|Set the url to share 229 | sharer|socialshare-text=""|String|false|Set the content to share 230 | sharer|socialshare-media=""|URL|false|Set the media url to share 231 | 232 | #### Delicious 233 | 234 | (`socialshare-provider="delicious"`) 235 | 236 | Method | Option | Type | Default | Description 237 | ------------- | ------------- | ------------- | ------------- | ------------- 238 | sharer|socialshare-url=""|URL|page URL|Set the url to share 239 | sharer|socialshare-text=""|String|false|Set the content to share 240 | sharer|socialshare-media=""|URL|false|Set the media url to share 241 | 242 | #### StumbleUpon 243 | 244 | (`socialshare-provider="stumbleupon"`) 245 | 246 | Method | Option | Type | Default | Description 247 | ------------- | ------------- | ------------- | ------------- | ------------- 248 | sharer|socialshare-url=""|URL|page URL|Set the url to share 249 | sharer|socialshare-text=""|String|false|Set the content to share 250 | sharer|socialshare-media=""|URL|false|Set the media url to share 251 | 252 | #### Pinterest 253 | 254 | (`socialshare-provider="pinterest"`) 255 | 256 | Method | Option | Type | Default | Description 257 | ------------- | ------------- | ------------- | ------------- | ------------- 258 | sharer|socialshare-url=""|URL|page URL|Set the url to share 259 | sharer|socialshare-text=""|String|false|Set the content to share 260 | sharer|socialshare-media=""|URL|false|Set the media url to share 261 | 262 | #### Google (Plus) 263 | 264 | (`socialshare-provider="google"`) 265 | 266 | Method | Option | Type | Default | Description 267 | ------------- | ------------- | ------------- | ------------- | ------------- 268 | sharer|socialshare-url=""|URL|page URL|Set the url to share 269 | 270 | #### Tumblr 271 | 272 | (`socialshare-provider="tumblr"`) 273 | 274 | Method | Option | Type | Default | Description 275 | ------------- | ------------- | ------------- | ------------- | ------------- 276 | sharer|socialshare-url=""|URL|page URL|Set the url to share 277 | sharer|socialshare-text=""|String|false|Set the content to share 278 | sharer|socialshare-media=""|URL|false|Set the media url to share 279 | 280 | #### Buffer 281 | 282 | (`socialshare-provider="buffer"`) 283 | 284 | Method | Option | Type | Default | Description 285 | ------------- | ------------- | ------------- | ------------- | ------------- 286 | sharer|socialshare-url=""|URL|page URL|Set the url to share 287 | sharer|socialshare-text=""|String|false|Set the content to share 288 | sharer|socialshare-media=""|URL|false|Set the media url to share 289 | sharer|socialshare-via=""|URL|false|Set the buffer via 290 | 291 | #### Pocket 292 | 293 | (`socialshare-provider="pocket"`) 294 | 295 | Method | Option | Type | Default | Description 296 | ------------- | ------------- | ------------- | ------------- | ------------- 297 | sharer|socialshare-url=""|URL|page URL|Set the url to share 298 | sharer|socialshare-text=""|String|false|Set the content to share 299 | 300 | #### Flipboard 301 | 302 | (`socialshare-provider="flipboard"`) 303 | 304 | Method | Option | Type | Default | Description 305 | ------------- | ------------- | ------------- | ------------- | ------------- 306 | sharer|socialshare-url=""|URL|page URL|Set the url to share 307 | sharer|socialshare-text=""|String|false|Set the content to share 308 | 309 | #### Evernote 310 | 311 | (`socialshare-provider="evernote"`) 312 | 313 | Method | Option | Type | Default | Description 314 | ------------- | ------------- | ------------- | ------------- | ------------- 315 | sharer|socialshare-url=""|URL|page URL|Set the url to share 316 | sharer|socialshare-text=""|String|false|Set the content to share 317 | 318 | 319 | #### Hacker News 320 | 321 | (`socialshare-provider="hackernews"`) 322 | 323 | Method | Option | Type | Default | Description 324 | ------------- | ------------- | ------------- | ------------- | ------------- 325 | sharer|socialshare-url=""|URL|page URL|Set the url to share 326 | sharer|socialshare-text=""|String|false|Set the content to share 327 | 328 | #### Wordpress 329 | 330 | (`socialshare-provider="wordpress"`) 331 | 332 | Method | Option | Type | Default | Description 333 | ------------- | ------------- | ------------- | ------------- | ------------- 334 | sharer|socialshare-url=""|URL|page URL|Set the url to share 335 | sharer|socialshare-text=""|String|false|Set the content to share 336 | sharer|socialshare-media=""|URL|false|Set the media url to share 337 | 338 | 339 | #### Xing 340 | 341 | (`socialshare-provider="xing"`) 342 | 343 | Method | Option | Type | Default | Description 344 | ------------- | ------------- | ------------- | ------------- | ------------- 345 | sharer|socialshare-url=""|URL|page URL|Set the url to share 346 | sharer|socialshare-text=""|String|false|Set the content to share 347 | sharer|socialshare-media=""|URL|false|Set the media url to share 348 | sharer|socialshare-follow=""|URL|false| Set the Xing page url which will be then suggested to you to follow 349 | 350 | 351 | #### Whatsapp 352 | `mobile only` - (works only for `` elements, it is a direct link) 353 | 354 | (`socialshare-provider="whatsapp"`) 355 | 356 | Method | Option | Type | Default | Description 357 | ------------- | ------------- | ------------- | ------------- | ------------- 358 | sharer|socialshare-url=""|URL|page URL|Set the url to share 359 | sharer|socialshare-text=""|String|false|Set the content to share 360 | 361 | #### Telegram 362 | 363 | (`socialshare-provider="telegram"`) 364 | 365 | Method | Option | Type | Default | Description 366 | ------------- | ------------- | ------------- | ------------- | ------------- 367 | sharer|socialshare-url=""|URL|page URL|Set the url to share 368 | sharer|socialshare-text=""|String|false|Set the content to share 369 | 370 | 371 | #### Viber 372 | `mobile only` - (works only for `` elements, it is a direct link) 373 | 374 | (`socialshare-provider="viber"`) 375 | 376 | Method | Option | Type | Default | Description 377 | ------------- | ------------- | ------------- | ------------- | ------------- 378 | sharer|socialshare-url=""|URL|page URL|Set the url to share 379 | sharer|socialshare-text=""|String|false|Set the content to share 380 | 381 | 382 | #### Skype 383 | 384 | (`socialshare-provider="skype"`) 385 | 386 | Method | Option | Type | Default | Description 387 | ------------- | ------------- | ------------- | ------------- | ------------- 388 | sharer|socialshare-url=""|URL|page URL|Set the url to share 389 | sharer|socialshare-text=""|String|false|Set the content to share 390 | 391 | #### Email 392 | 393 | (`socialshare-provider="email"`) 394 | 395 | Method | Option | Type | Default | Description 396 | ------------- | ------------- | ------------- | ------------- | ------------- 397 | mailto|socialshare-subject=""|String|false|Set the subject for the email 398 | mailto|socialshare-body=""|String|false|Set the body content for the email 399 | mailto|socialshare-to=""|String|false|Set the Receiver / Receivers 400 | mailto|socialshare-cc=""|String|false|Set the CC / CCs for the email 401 | mailto|socialshare-bcc=""|String|false|Set the BCC / BCCs for the email 402 | 403 | #### Sms 404 | (works only for `` elements, it is a direct link) 405 | 406 | (`socialshare-provider="sms"`) 407 | 408 | Method | Option | Type | Default | Description 409 | ------------- | ------------- | ------------- | ------------- | ------------- 410 | sharer|socialshare-url=""|URL|page URL|Set the url to share 411 | sharer|socialshare-text=""|String|false|Set the content to share 412 | sharer|socialshare-to=""|URL|false|Set the phone number of the contact 413 | 414 | 415 | #### Weibo 416 | 417 | (`socialshare-provider="weibo"`) 418 | 419 | Method | Option | Type | Default | Description 420 | ------------- | ------------- | ------------- | ------------- | ------------- 421 | sharer|socialshare-url=""|URL|page URL|Set the url to share 422 | sharer|socialshare-text=""|String|false|Set the content to share 423 | 424 | ## Options 425 | 426 | #### Sharing Popup Size 427 | You can set a specific Height or Width for the sharing popup using the `socialshare-popup-height=""` and `socialshare-popup-width=""` attributes (sometimes, if if the popup is too small, it gets resized by third parties) 428 | 429 | ```html 430 | 437 | Share with a bigger popup 438 | 439 | ``` 440 | 441 | #### Sharing Event Trigger 442 | You can choose to bind a different event trigger for showing up the sharer popup using the `socialshare-trigger=""` attribute (you can use any angular `element.bind()` event you want) 443 | 444 | ```html 445 | 450 | Share me when mouse is over 451 | 452 | ``` 453 | or a set of 454 | 455 | ```html 456 | 461 | Share me when focusout or mouseleave 462 | 463 | ``` 464 | 465 | ## Service 466 | You may need to share from a controller (for example), this is how to use the `Socialshare` service: 467 | 468 | ```javascript 469 | .controller('Ctrl', ['Socialshare', function testController(Socialshare) { 470 | 471 | Socialshare.share({ 472 | 'provider': 'facebook', 473 | 'attrs': { 474 | 'socialshareUrl': 'http://720kb.net' 475 | } 476 | }); 477 | 478 | Socialshare.share({ 479 | 'provider': 'twitter', 480 | 'attrs': { 481 | 'socialshareUrl': 'http://720kb.net', 482 | 'socialshareHashtags': '720kb, angular, socialshare' 483 | } 484 | }); 485 | //every attrs must be in camel case as showed above 486 | //this will open the share popup immediately without any trigger event required 487 | ``` 488 | _Some providers (specially mobile provider, such as: Viber, Whatsapp etc..) do not work with a Service call, because their API or Usage does not allow a trigger event on them_ 489 | 490 | ## Globals 491 | 492 | #### Provider setup 493 | Sometimes you may need to set default values for all the sharing buttons, here is how to setup this: 494 | 495 | ```javascript 496 | .config(['socialshareConfProvider', function configApp(socialshareConfProvider) { 497 | 498 | socialshareConfProvider.configure([ 499 | { 500 | 'provider': 'twitter', 501 | 'conf': { 502 | 'url': 'http://720kb.net', 503 | 'text': '720kb is enough', 504 | 'via': 'npm', 505 | 'hashtags': 'angularjs,socialshare,angular-socialshare', 506 | 'trigger': 'click', 507 | 'popupHeight': 800, 508 | 'popupWidth' : 400 509 | } 510 | }, 511 | { 512 | 'provider': 'facebook', 513 | 'conf': { 514 | 'url': 'http://720kb.net', 515 | 'trigger': 'mouseover', 516 | 'popupHeight': 1300, 517 | 'popupWidth' : 1000 518 | } 519 | } 520 | //and so on ... 521 | ]); 522 | }]); 523 | ``` 524 | *NB* if you define the provider settings, but then you change the option value by html attributes, the html attribute value will be the final one (the one that will be used) 525 | 526 | 527 | #### [Live demo](https://720kb.github.io/angular-socialshare) 528 | 529 | 530 | ## Contributing 531 | 532 | We will be much grateful if you help us making this project to grow up. 533 | Feel free to contribute by forking, opening issues, pull requests etc. 534 | 535 | ## License 536 | 537 | The MIT License (MIT) 538 | 539 | Copyright (c) 2014 Filippo Oretti, Dario Andrei 540 | 541 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 542 | 543 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 544 | 545 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 546 | -------------------------------------------------------------------------------- /assets/js/index.js: -------------------------------------------------------------------------------- 1 | /*global angular*/ 2 | 3 | (function withAngular(angular) { 4 | 'use strict'; 5 | 6 | angular.module('720kb', [ 7 | 'ngRoute', 8 | '720kb.socialshare' 9 | ]) 10 | .config(['socialshareConfProvider', function configApp(socialshareConfProvider) { 11 | 12 | socialshareConfProvider.configure([{ 13 | 'provider': 'twitter', 14 | 'conf': { 15 | 'url': 'http://720kb.net', 16 | 'text': '720kb is enough', 17 | 'via': 'npm', 18 | 'hashtags': 'angularjs,socialshare,angular-socialshare', 19 | 'trigger': 'click', 20 | 'popupHeight': 800, 21 | 'popupWidth' : 400 22 | } 23 | }]); 24 | }]) 25 | .controller('TestController', ['$scope', '$timeout', 'Socialshare', function testController($scope, $timeout, Socialshare) { 26 | var that = this; 27 | //Call service to trigger immediately the sharing method 28 | /*Socialshare.share({ 29 | 'provider': 'twitter', 30 | 'attrs': { 31 | 'socialshareUrl': 'http://720kb.net', 32 | 'socialshareHashtags': '720kb,angular, socialshare' 33 | } 34 | });*/ 35 | $timeout(function scopeValueTimeout() { 36 | 37 | that.testValue = '720kb'; 38 | }, 3000); 39 | }]); 40 | }(angular)); 41 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-socialshare", 3 | "version": "2.3.11", 4 | "description": "A social media url and content share module for angularjs.", 5 | "authors": [ 6 | "Filippo Oretti " 8 | ], 9 | "ignore": [ 10 | "lib", 11 | "conf", 12 | "package.json", 13 | ".gitignore", 14 | "assets", 15 | "*.html", 16 | ".eslintrc", 17 | ".jscsrc", 18 | "gulpfiles.js", 19 | "node_modules" 20 | ], 21 | "keywords": [ 22 | "social", 23 | "sharing", 24 | "buttons", 25 | "share", 26 | "angular", 27 | "angularjs" 28 | ], 29 | "main": [ 30 | "./dist/angular-socialshare.min.js" 31 | ], 32 | "license": "MIT", 33 | "homepage": "http://720kb.github.io/angular-socialshare/", 34 | "ignore": [ 35 | "**/.*", 36 | "node_modules", 37 | "bower_components", 38 | "test", 39 | "tests", 40 | "conf", 41 | "gulpfile.js", 42 | "index.html", 43 | "assets" 44 | ] 45 | } 46 | -------------------------------------------------------------------------------- /conf/paths.js: -------------------------------------------------------------------------------- 1 | /*global require,module*/ 2 | (function pathConfiguration(require, module) { 3 | 'use strict'; 4 | 5 | var infos = require('../package.json') 6 | , today = new Date() 7 | , banner = ['/*', 8 | ' * ' + infos.name, 9 | ' * ' + infos.version, 10 | ' * ', 11 | ' * ' + infos.description, 12 | ' * ' + infos.homepage, 13 | ' * ', 14 | ' * ' + infos.license + ' license', 15 | ' * ' + today.toDateString('yyyy-MM-dd'), 16 | ' */', 17 | ''].join('\n') 18 | , paths = { 19 | 'banner': banner, 20 | 'lib': 'lib/', 21 | 'output': 'dist/', 22 | 'files': { 23 | 'unminified': { 24 | 'js': 'angular-socialshare.js' 25 | }, 26 | 'minified': { 27 | 'js': 'angular-socialshare.min.js' 28 | } 29 | }, 30 | 'scss': { 31 | 'files': [ 32 | 'lib/**/*.scss' 33 | ], 34 | 'options': {} 35 | }, 36 | 'assets': [ 37 | 'lib/**/*.json', 38 | 'lib/**/*.svg', 39 | 'lib/**/*.woff', 40 | 'lib/**/*.ttf', 41 | 'lib/**/*.png', 42 | 'lib/**/*.ico', 43 | 'lib/**/*.jpg', 44 | 'lib/**/*.gif', 45 | 'lib/**/*.eot' 46 | ] 47 | }; 48 | 49 | module.exports = paths; 50 | }(require, module)); 51 | 52 | -------------------------------------------------------------------------------- /conf/tasks/annotate.js: -------------------------------------------------------------------------------- 1 | /*global require*/ 2 | (function buildTask(require) { 3 | 'use strict'; 4 | 5 | var gulp = require('gulp') 6 | , changed = require('gulp-changed') 7 | , plumber = require('gulp-plumber') 8 | , ngAnnotate = require('gulp-ng-annotate') 9 | , paths = require('../paths') 10 | , header = require('gulp-header'); 11 | 12 | gulp.task('annotate', function onEs6() { 13 | 14 | return gulp.src(paths.lib + paths.files.unminified.js) 15 | .pipe(plumber()) 16 | .pipe(changed(paths.output, { 17 | 'extension': '.js' 18 | })) 19 | .pipe(ngAnnotate({ 20 | 'gulpWarnings': false 21 | })) 22 | .pipe(header(paths.banner)) 23 | .pipe(gulp.dest(paths.output)); 24 | }); 25 | }(require)); 26 | -------------------------------------------------------------------------------- /conf/tasks/build.js: -------------------------------------------------------------------------------- 1 | /*global require*/ 2 | (function buildTask(require) { 3 | 'use strict'; 4 | 5 | var gulp = require('gulp') 6 | , runSequence = require('run-sequence'); 7 | 8 | gulp.task('build', function onBuild(done) { 9 | 10 | return runSequence('clean', [ 11 | 'annotate', 12 | 'move' 13 | ], 14 | done); 15 | }); 16 | }(require)); 17 | -------------------------------------------------------------------------------- /conf/tasks/clean.js: -------------------------------------------------------------------------------- 1 | /*global require*/ 2 | (function buildTask(require) { 3 | 'use strict'; 4 | 5 | var gulp = require('gulp') 6 | , del = require('del') 7 | , vinylPaths = require('vinyl-paths') 8 | , paths = require('../paths'); 9 | 10 | gulp.task('clean', function onClean() { 11 | return gulp.src(paths.output) 12 | .pipe(vinylPaths(del)); 13 | }); 14 | }(require)); 15 | -------------------------------------------------------------------------------- /conf/tasks/lint.js: -------------------------------------------------------------------------------- 1 | /*global require*/ 2 | (function lintTask(require) { 3 | 'use strict'; 4 | 5 | var gulp = require('gulp') 6 | , jshint = require('gulp-jshint') 7 | , eslint = require('gulp-eslint') 8 | , jscs = require('gulp-jscs') 9 | , stylish = require('jshint-stylish') 10 | , runSequence = require('run-sequence') 11 | , paths = require('../paths'); 12 | 13 | gulp.task('js-lint', function onJsLint() { 14 | 15 | return gulp.src(paths.lib + paths.files.unminified) 16 | .pipe(jshint()) 17 | .pipe(jshint.reporter(stylish)) 18 | .pipe(eslint()) 19 | .pipe(eslint.format()) 20 | .pipe(eslint.failOnError()) 21 | .pipe(jscs()) 22 | .pipe(jscs.reporter()) 23 | .pipe(jscs.reporter('fail')); 24 | }); 25 | 26 | gulp.task('lint', function onLint(done) { 27 | 28 | return runSequence('js-lint', done); 29 | }); 30 | }(require)); 31 | -------------------------------------------------------------------------------- /conf/tasks/minify.js: -------------------------------------------------------------------------------- 1 | /*global require*/ 2 | (function buildTask(require) { 3 | 'use strict'; 4 | 5 | var gulp = require('gulp') 6 | , plumber = require('gulp-plumber') 7 | , sourcemaps = require('gulp-sourcemaps') 8 | , paths = require('../paths') 9 | , header = require('gulp-header') 10 | , uglify = require('gulp-uglify') 11 | , rename = require('gulp-rename') 12 | , runSequence = require('run-sequence'); 13 | 14 | gulp.task('minify', ['build'], function onMinify(done) { 15 | 16 | return runSequence([ 17 | 'minify-js' 18 | ], done); 19 | }); 20 | 21 | gulp.task('minify-js', function onMinifyJs() { 22 | 23 | return gulp.src(paths.output + paths.files.unminified.js) 24 | .pipe(plumber()) 25 | .pipe(sourcemaps.init({ 26 | 'loadMaps': true, 27 | 'debug': true 28 | })) 29 | .pipe(uglify()) 30 | .pipe(header(paths.banner)) 31 | .pipe(sourcemaps.write('.', { 32 | 'includeContent': false, 33 | 'sourceRoot': '../lib' 34 | })) 35 | .pipe(rename(function onFileRename(path) { 36 | if (path.extname !== '.map') { 37 | path.basename += '.min'; 38 | } 39 | return path; 40 | })) 41 | .pipe(gulp.dest(paths.output)); 42 | }); 43 | 44 | }(require)); 45 | -------------------------------------------------------------------------------- /conf/tasks/move.js: -------------------------------------------------------------------------------- 1 | /*global require*/ 2 | (function buildTask(require) { 3 | 'use strict'; 4 | 5 | var gulp = require('gulp') 6 | , paths = require('../paths'); 7 | 8 | gulp.task('move', function onMove() { 9 | 10 | return gulp.src(paths.assets) 11 | .pipe(gulp.dest(paths.output)); 12 | }); 13 | }(require)); 14 | -------------------------------------------------------------------------------- /conf/tasks/serve.js: -------------------------------------------------------------------------------- 1 | /*global console,__dirname,require*/ 2 | (function serveTask(console, __dirname, require) { 3 | 'use strict'; 4 | 5 | var gulp = require('gulp') 6 | , browserSync = require('browser-sync') 7 | , historyApiFallback = require('connect-history-api-fallback'); 8 | 9 | gulp.task('serve', ['watch'], function runBrowserSync(done) { 10 | 11 | browserSync({ 12 | 'open': true, 13 | 'ui': false, 14 | 'port': 8100, 15 | 'server': { 16 | 'baseDir': ['.'], 17 | 'middleware': [ 18 | historyApiFallback() 19 | ] 20 | } 21 | }, done); 22 | }); 23 | }(console, __dirname, require)); 24 | -------------------------------------------------------------------------------- /conf/tasks/watch.js: -------------------------------------------------------------------------------- 1 | /*global require,console*/ 2 | (function watchTask(require, console) { 3 | 'use strict'; 4 | 5 | var gulp = require('gulp') 6 | , paths = require('../paths') 7 | , browserSync = require('browser-sync') 8 | , changed = function changed(event) { 9 | 10 | /*eslint-disable no-console*/ 11 | console.log('File ' + event.path + ' was ' + event.type + ', running tasks...'); 12 | /*eslint-enable no-console*/ 13 | }; 14 | 15 | gulp.task('watch', ['lint', 'build'], function onWatch() { 16 | 17 | gulp.watch([paths.lib + paths.files.unminified.js], ['annotate', browserSync.reload]).on('change', changed); 18 | }); 19 | }(require, console)); 20 | -------------------------------------------------------------------------------- /dist/angular-socialshare.js: -------------------------------------------------------------------------------- 1 | /* 2 | * angular-socialshare 3 | * 2.3.11 4 | * 5 | * A social media url and content share module for angularjs. 6 | * http://720kb.github.io/angular-socialshare 7 | * 8 | * MIT license 9 | * Fri Jun 23 2017 10 | */ 11 | /*global angular*/ 12 | /*eslint no-loop-func:0, func-names:0*/ 13 | 14 | (function withAngular(angular) { 15 | 'use strict'; 16 | 17 | var directiveName = 'socialshare' 18 | , serviceName = 'Socialshare' 19 | , socialshareProviderNames = ['facebook', 'facebook-messenger','sms', 'twitter', 'linkedin', 'google', 'pinterest', 'tumblr', 'reddit', 'stumbleupon', 'buffer', 'digg', 'delicious', 'vk', 'pocket', 'wordpress', 'flipboard', 'xing', 'hackernews', 'evernote', 'whatsapp', 'telegram', 'viber', 'skype', 'email', 'ok', 'weibo'] 20 | , socialshareConfigurationProvider = /*@ngInject*/ function socialshareConfigurationProvider() { 21 | 22 | var socialshareConfigurationDefault = [{ 23 | 'provider': 'email', 24 | 'conf': { 25 | 'subject': '', 26 | 'body': '', 27 | 'to': '', 28 | 'cc': '', 29 | 'bcc': '', 30 | 'trigger': 'click' 31 | } 32 | }, 33 | { 34 | 'provider': 'facebook', 35 | 'conf': { 36 | 'url':'', 37 | 'title':'', 38 | 'href':'', 39 | 'quote':'', 40 | 'hashtags':'', 41 | 'text': '', 42 | 'media': '', 43 | 'mobile_iframe': '', 44 | 'type': '', 45 | 'via': '', 46 | 'to': '', 47 | 'from': '', 48 | 'ref': '', 49 | 'display': '', 50 | 'source': '', 51 | 'caption': '', 52 | 'redirectUri': '', 53 | 'trigger': 'click', 54 | 'popupHeight': 600, 55 | 'popupWidth': 500 56 | } 57 | }, 58 | { 59 | 'provider': 'facebook-messenger', 60 | 'conf': { 61 | 'url': '' 62 | } 63 | }, 64 | { 65 | 'provider': 'twitter', 66 | 'conf': { 67 | 'url': '', 68 | 'text': '', 69 | 'via': '', 70 | 'hashtags': '', 71 | 'trigger': 'click', 72 | 'popupHeight': 600, 73 | 'popupWidth': 500 74 | } 75 | }, 76 | { 77 | 'provider': 'linkedin', 78 | 'conf': { 79 | 'url': '', 80 | 'text': '', 81 | 'description': '', 82 | 'source': '', 83 | 'trigger': 'click', 84 | 'popupHeight': 600, 85 | 'popupWidth': 500 86 | } 87 | }, 88 | { 89 | 'provider': 'reddit', 90 | 'conf': { 91 | 'url': '', 92 | 'text': '', 93 | 'subreddit': '', 94 | 'trigger': 'click', 95 | 'popupHeight': 600, 96 | 'popupWidth': 500 97 | } 98 | }, 99 | { 100 | 'provider': 'vk', 101 | 'conf': { 102 | 'url': '', 103 | 'text': '', 104 | 'media': '', 105 | 'trigger': 'click', 106 | 'popupHeight': 600, 107 | 'popupWidth': 500 108 | } 109 | }, 110 | { 111 | 'provider': 'ok', 112 | 'conf': { 113 | 'url': '', 114 | 'text': '', 115 | 'trigger': 'click', 116 | 'popupHeight': 600, 117 | 'popupWidth': 500 118 | } 119 | }, 120 | { 121 | 'provider': 'digg', 122 | 'conf': { 123 | 'url': '', 124 | 'text': '', 125 | 'media': '', 126 | 'trigger': 'click', 127 | 'popupHeight': 600, 128 | 'popupWidth': 500 129 | } 130 | }, 131 | { 132 | 'provider': 'delicious', 133 | 'conf': { 134 | 'url': '', 135 | 'text': '', 136 | 'media': '', 137 | 'trigger': 'click', 138 | 'popupHeight': 600, 139 | 'popupWidth': 500 140 | } 141 | }, 142 | { 143 | 'provider': 'stumbleupon', 144 | 'conf': { 145 | 'url': '', 146 | 'text': '', 147 | 'media': '', 148 | 'trigger': 'click', 149 | 'popupHeight': 600, 150 | 'popupWidth': 500 151 | } 152 | }, 153 | { 154 | 'provider': 'pinterest', 155 | 'conf': { 156 | 'url': '', 157 | 'text': '', 158 | 'media': '', 159 | 'trigger': 'click', 160 | 'popupHeight': 600, 161 | 'popupWidth': 500 162 | } 163 | }, 164 | { 165 | 'provider': 'google', 166 | 'conf': { 167 | 'url': '', 168 | 'text': '', 169 | 'media': '', 170 | 'trigger': 'click', 171 | 'popupHeight': 600, 172 | 'popupWidth': 500 173 | } 174 | }, 175 | { 176 | 'provider': 'tumblr', 177 | 'conf': { 178 | 'url': '', 179 | 'text': '', 180 | 'media': '', 181 | 'trigger': 'click', 182 | 'popupHeight': 600, 183 | 'popupWidth': 500 184 | } 185 | }, 186 | { 187 | 'provider': 'buffer', 188 | 'conf': { 189 | 'url': '', 190 | 'text': '', 191 | 'via': '', 192 | 'media': '', 193 | 'trigger': 'click', 194 | 'popupHeight': 600, 195 | 'popupWidth': 500 196 | } 197 | }, 198 | { 199 | 'provider': 'pocket', 200 | 'conf': { 201 | 'url': '', 202 | 'text': '', 203 | 'trigger': 'click', 204 | 'popupHeight': 600, 205 | 'popupWidth': 500 206 | } 207 | }, 208 | { 209 | 'provider': 'flipboard', 210 | 'conf': { 211 | 'url': '', 212 | 'text': '', 213 | 'trigger': 'click', 214 | 'popupHeight': 600, 215 | 'popupWidth': 500 216 | } 217 | }, 218 | { 219 | 'provider': 'hackernews', 220 | 'conf': { 221 | 'url': '', 222 | 'text': '', 223 | 'trigger': 'click', 224 | 'popupHeight': 600, 225 | 'popupWidth': 500 226 | } 227 | }, 228 | { 229 | 'provider': 'wordpress', 230 | 'conf': { 231 | 'url': '', 232 | 'text': '', 233 | 'media': '', 234 | 'trigger': 'click', 235 | 'popupHeight': 600, 236 | 'popupWidth': 500 237 | } 238 | }, 239 | { 240 | 'provider': 'xing', 241 | 'conf': { 242 | 'url': '', 243 | 'text': '', 244 | 'media': '', 245 | 'follow' : '', 246 | 'trigger': 'click', 247 | 'popupHeight': 600, 248 | 'popupWidth': 500 249 | } 250 | }, 251 | { 252 | 'provider': 'evernote', 253 | 'conf': { 254 | 'url': '', 255 | 'text': '', 256 | 'trigger': 'click', 257 | 'popupHeight': 600, 258 | 'popupWidth': 500 259 | } 260 | }, 261 | { 262 | 'provider': 'whatsapp', 263 | 'conf': { 264 | 'url': '', 265 | 'text': '' 266 | } 267 | }, 268 | { 269 | 'provider': 'sms', 270 | 'conf': { 271 | 'url': '', 272 | 'text': '', 273 | 'to': '', 274 | 'trigger': 'click' 275 | } 276 | }, 277 | { 278 | 'provider': 'telegram', 279 | 'conf': { 280 | 'url': '', 281 | 'text': '', 282 | 'trigger': 'click', 283 | 'popupHeight': 600, 284 | 'popupWidth': 500 285 | } 286 | }, 287 | { 288 | 'provider': 'viber', 289 | 'conf': { 290 | 'url': '', 291 | 'text': '' 292 | } 293 | }, 294 | { 295 | 'provider': 'skype', 296 | 'conf': { 297 | 'url': '', 298 | 'text': '', 299 | 'trigger': 'click', 300 | 'popupHeight': 600, 301 | 'popupWidth': 500 302 | } 303 | }, 304 | { 305 | 'provider': 'weibo', 306 | 'conf': { 307 | 'url': '', 308 | 'text': '', 309 | 'trigger': 'click', 310 | 'popupHeight': 600, 311 | 'popupWidth': 500 312 | } 313 | }]; 314 | 315 | return { 316 | 'configure': function configure(configuration) { 317 | 318 | var configIndex = 0 319 | , configurationKeys 320 | , configurationIndex 321 | , aConfigurationKey 322 | , configElement 323 | , internIndex = 0 324 | //this is necessary becuase provider run before any service 325 | //so i have to take the log from another injector 326 | , $log = angular.injector(['ng']).get('$log'); 327 | 328 | if (configuration && configuration.length > 0) { 329 | for (; configIndex < configuration.length; configIndex += 1) { 330 | if (configuration[configIndex].provider && socialshareProviderNames.indexOf(configuration[configIndex].provider) > -1) { 331 | 332 | for (; internIndex < socialshareConfigurationDefault.length; internIndex += 1) { 333 | configElement = socialshareConfigurationDefault[internIndex]; 334 | 335 | if (configElement && 336 | configElement.provider && 337 | configuration[configIndex].provider === configElement.provider) { 338 | 339 | configurationKeys = Object.keys(configElement.conf); 340 | configurationIndex = 0; 341 | 342 | for (; configurationIndex < configurationKeys.length; configurationIndex += 1) { 343 | 344 | aConfigurationKey = configurationKeys[configurationIndex]; 345 | if (aConfigurationKey && configuration[configIndex].conf[aConfigurationKey]) { 346 | 347 | configElement.conf[aConfigurationKey] = configuration[configIndex].conf[aConfigurationKey]; 348 | } 349 | } 350 | 351 | // once the provider has been found and configuration applied 352 | // we should reset the internIndex for the next provider match to work correctly 353 | // and break, to skip loops on unwanted next providers 354 | internIndex = 0; 355 | break; 356 | } 357 | } 358 | } else { 359 | $log.warn('Invalid provider at element ' + configIndex + ' with name:' + configuration[configIndex].provider); 360 | } 361 | } 362 | } 363 | } 364 | , '$get': /*@ngInject*/ function instantiateProvider() { 365 | 366 | return socialshareConfigurationDefault; 367 | } 368 | }; 369 | } 370 | , manageFacebookShare = function manageFacebookShare($window, attrs) { 371 | 372 | var urlString; 373 | 374 | if (attrs.socialshareType && attrs.socialshareType === 'feed') { 375 | // if user specifies that they want to use the Facebook feed dialog 376 | //(https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.4) 377 | urlString = 'https://www.facebook.com/dialog/feed?'; 378 | 379 | if (attrs.socialshareVia) { 380 | urlString += '&app_id=' + encodeURIComponent(attrs.socialshareVia); 381 | } 382 | 383 | if (attrs.socialshareRedirectUri) { 384 | urlString += '&redirect_uri=' + encodeURIComponent(attrs.socialshareRedirectUri); 385 | } 386 | if (attrs.socialshareUrl) { 387 | urlString += '&link=' + encodeURIComponent(attrs.socialshareUrl); 388 | } 389 | 390 | if (attrs.socialshareTo) { 391 | urlString += '&to=' + encodeURIComponent(attrs.socialshareTo); 392 | } 393 | 394 | if (attrs.socialshareDisplay) { 395 | urlString += '&display=' + encodeURIComponent(attrs.socialshareDisplay); 396 | } 397 | 398 | if (attrs.socialshareRef) { 399 | urlString += '&ref=' + encodeURIComponent(attrs.socialshareRef); 400 | } 401 | 402 | if (attrs.socialshareFrom) { 403 | urlString += '&from=' + encodeURIComponent(attrs.socialshareFrom); 404 | } 405 | 406 | if (attrs.socialshareSource) { 407 | urlString += '&source=' + encodeURIComponent(attrs.socialshareSource); 408 | } 409 | 410 | $window.open( 411 | urlString, 412 | 'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 413 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 414 | 415 | } else if (attrs.socialshareType && attrs.socialshareType === 'share') { 416 | // if user specifies that they want to use the Facebook share dialog 417 | //(https://developers.facebook.com/docs/sharing/reference/share-dialog) 418 | urlString = 'https://www.facebook.com/dialog/share?'; 419 | 420 | if (attrs.socialshareVia) { 421 | urlString += '&app_id=' + encodeURIComponent(attrs.socialshareVia); 422 | } 423 | 424 | if (attrs.socialshareRedirectUri) { 425 | urlString += '&redirect_uri=' + encodeURIComponent(attrs.socialshareRedirectUri); 426 | } 427 | 428 | if (attrs.socialshareUrl) { 429 | urlString += '&href=' + encodeURIComponent(attrs.socialshareUrl); 430 | } 431 | 432 | if (attrs.socialshareQuote) { 433 | urlString += '"e=' + encodeURIComponent(attrs.socialshareQuote); 434 | } 435 | 436 | if (attrs.socialshareDisplay) { 437 | urlString += '&display=' + encodeURIComponent(attrs.socialshareDisplay); 438 | } 439 | 440 | if (attrs.socialshareMobileiframe) { 441 | urlString += '&mobile_iframe=' + encodeURIComponent(attrs.socialshareMobileiframe); 442 | } 443 | 444 | if (attrs.socialshareHashtags) { 445 | urlString += '&hashtag=' + encodeURIComponent(attrs.socialshareHashtags); 446 | } 447 | 448 | 449 | $window.open( 450 | urlString, 451 | 'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 452 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 453 | 454 | } else if (attrs.socialshareType && attrs.socialshareType === 'send') { 455 | // if user specifies that they want to use the Facebook send dialog 456 | //(https://developers.facebook.com/docs/sharing/reference/send-dialog) 457 | urlString = 'https://www.facebook.com/dialog/send?'; 458 | 459 | if (attrs.socialshareVia) { 460 | urlString += '&app_id=' + encodeURIComponent(attrs.socialshareVia); 461 | } 462 | 463 | if (attrs.socialshareRedirectUri) { 464 | urlString += '&redirect_uri=' + encodeURIComponent(attrs.socialshareRedirectUri); 465 | } 466 | 467 | if (attrs.socialshareUrl) { 468 | urlString += '&link=' + encodeURIComponent(attrs.socialshareUrl); 469 | } 470 | 471 | if (attrs.socialshareTo) { 472 | urlString += '&to=' + encodeURIComponent(attrs.socialshareTo); 473 | } 474 | 475 | if (attrs.socialshareDisplay) { 476 | urlString += '&display=' + encodeURIComponent(attrs.socialshareDisplay); 477 | } 478 | 479 | $window.open( 480 | urlString, 481 | 'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 482 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 483 | 484 | } else { 485 | //otherwise default to using sharer.php 486 | $window.open( 487 | 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) 488 | , 'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 489 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 490 | } 491 | } 492 | , manageEmailShare = function manageEmailShare($window, attrs) { 493 | var urlString = 'mailto:'; 494 | 495 | if (attrs.socialshareTo) { 496 | 497 | urlString += encodeURIComponent(attrs.socialshareTo); 498 | } 499 | 500 | urlString += '?'; 501 | 502 | if (attrs.socialshareBody) { 503 | 504 | urlString += 'body=' + encodeURIComponent(attrs.socialshareBody); 505 | } 506 | 507 | if (attrs.socialshareSubject) { 508 | 509 | urlString += '&subject=' + encodeURIComponent(attrs.socialshareSubject); 510 | } 511 | if (attrs.socialshareCc) { 512 | 513 | urlString += '&cc=' + encodeURIComponent(attrs.socialshareCc); 514 | } 515 | if (attrs.socialshareBcc) { 516 | 517 | urlString += '&bcc=' + encodeURIComponent(attrs.socialshareBcc); 518 | } 519 | if ($window.self !== $window.top) { 520 | $window.open(urlString, '_blank'); 521 | } else { 522 | $window.open(urlString, '_self'); 523 | } 524 | 525 | } 526 | , facebookMessengerShare = function facebookMessengerShare($window, attrs, element) { 527 | 528 | var href = 'fb-messenger://share?link=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 529 | 530 | element.attr('href', href); 531 | element.attr('target', '_top'); 532 | } 533 | , manageTwitterShare = function manageTwitterShare($window, attrs) { 534 | var urlString = 'https://www.twitter.com/intent/tweet?'; 535 | 536 | if (attrs.socialshareText) { 537 | urlString += 'text=' + encodeURIComponent(attrs.socialshareText); 538 | } 539 | 540 | if (attrs.socialshareVia) { 541 | urlString += '&via=' + encodeURIComponent(attrs.socialshareVia); 542 | } 543 | 544 | if (attrs.socialshareHashtags) { 545 | urlString += '&hashtags=' + encodeURIComponent(attrs.socialshareHashtags); 546 | } 547 | 548 | //default to the current page if a URL isn't specified 549 | urlString += '&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 550 | 551 | $window.open( 552 | urlString, 553 | 'Twitter', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 554 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 555 | } 556 | , manageGooglePlusShare = function manageGooglePlusShare($window, attrs) { 557 | 558 | $window.open( 559 | 'https://plus.google.com/share?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) 560 | , 'Google+', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 561 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 562 | } 563 | , manageRedditShare = function manageRedditShare($window, attrs) { 564 | var urlString = 'https://www.reddit.com/'; 565 | 566 | if (attrs.socialshareSubreddit) { 567 | urlString += 'r/' + attrs.socialshareSubreddit + '/submit?url='; 568 | } else { 569 | urlString += 'submit?url='; 570 | } 571 | /*- 572 | * Reddit isn't responsive and at default width for our popups (500 x 500), everything is messed up. 573 | * So, overriding the width if it is less than 900 (played around to settle on this) and height if 574 | * it is less than 650px. 575 | */ 576 | if (attrs.socialsharePopupWidth < 900) { 577 | attrs.socialsharePopupWidth = 900; 578 | } 579 | 580 | if (attrs.socialsharePopupHeight < 650) { 581 | attrs.socialsharePopupHeight = 650; 582 | } 583 | 584 | $window.open( 585 | urlString + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&title=' + encodeURIComponent(attrs.socialshareText) 586 | , 'Reddit', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 587 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 588 | } 589 | , manageStumbleuponShare = function manageStumbleuponShare($window, attrs) { 590 | 591 | $window.open( 592 | 'https://www.stumbleupon.com/submit?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&title=' + encodeURIComponent(attrs.socialshareText) 593 | , 'StumbleUpon', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 594 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 595 | } 596 | , manageLinkedinShare = function manageLinkedinShare($window, attrs) { 597 | /* 598 | * Refer: https://developer.linkedin.com/docs/share-on-linkedin 599 | * Tab: Customized URL 600 | */ 601 | var urlString = 'https://www.linkedin.com/shareArticle?mini=true'; 602 | 603 | urlString += '&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 604 | 605 | if (attrs.socialshareText) { 606 | urlString += '&title=' + encodeURIComponent(attrs.socialshareText); 607 | } 608 | 609 | if (attrs.socialshareDescription) { 610 | urlString += '&summary=' + encodeURIComponent(attrs.socialshareDescription); 611 | } 612 | 613 | if (attrs.socialshareSource) { 614 | urlString += '&source=' + encodeURIComponent(attrs.socialshareSource); 615 | } 616 | 617 | $window.open( 618 | urlString, 619 | 'Linkedin', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 620 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 621 | } 622 | , managePinterestShare = function managePinterestShare($window, attrs) { 623 | 624 | $window.open( 625 | 'https://www.pinterest.com/pin/create/button/?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&media=' + encodeURIComponent(attrs.socialshareMedia) + '&description=' + encodeURIComponent(attrs.socialshareText) 626 | , 'Pinterest', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 627 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 628 | } 629 | , manageDiggShare = function manageDiggShare($window, attrs) { 630 | 631 | $window.open( 632 | 'https://www.digg.com/submit?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&title=' + encodeURIComponent(attrs.socialshareText) 633 | , 'Digg', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 634 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 635 | } 636 | , manageTumblrShare = function manageTumblrShare($window, attrs) { 637 | 638 | if (attrs.socialshareMedia) { 639 | var urlString = 'https://www.tumblr.com/share/photo?source=' + encodeURIComponent(attrs.socialshareMedia); 640 | 641 | if (attrs.socialshareText) { 642 | urlString += '&caption=' + encodeURIComponent(attrs.socialshareText); 643 | } 644 | 645 | $window.open( 646 | urlString, 647 | 'Tumblr', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 648 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 649 | } else { 650 | 651 | $window.open( 652 | 'https://www.tumblr.com/share/link?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&description=' + encodeURIComponent(attrs.socialshareText) 653 | , 'Tumblr', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 654 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 655 | } 656 | } 657 | , manageVkShare = function manageVkShare($window, attrs) { 658 | var urlString = 'https://www.vk.com/share.php?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 659 | 660 | if (attrs.socialshareText) { 661 | urlString += '&title=' + encodeURIComponent(attrs.socialshareText); 662 | } 663 | 664 | if (attrs.socialshareMedia) { 665 | urlString += '&image=' + encodeURIComponent(attrs.socialshareMedia); 666 | } 667 | 668 | if (attrs.socialshareDescription) { 669 | urlString += '&description=' + encodeURIComponent(attrs.socialshareDescription); 670 | } 671 | 672 | $window.open( 673 | urlString 674 | , 'Vk', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 675 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 676 | } 677 | , manageOkShare = function manageOkShare($window, attrs) { 678 | $window.open( 679 | 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&st.comments=' + encodeURIComponent(attrs.socialshareText) 680 | , 'Ok', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 681 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 682 | } 683 | , manageDeliciousShare = function manageDeliciousShare($window, attrs) { 684 | 685 | $window.open( 686 | 'https://www.delicious.com/save?v=5&noui&jump=close&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&title=' + encodeURIComponent(attrs.socialshareText) 687 | , 'Delicious', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 688 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 689 | } 690 | , manageBufferShare = function manageBufferShare($window, attrs) { 691 | var urlString = 'https://bufferapp.com/add?'; 692 | 693 | if (attrs.socialshareText) { 694 | urlString += 'text=' + encodeURIComponent(attrs.socialshareText); 695 | } 696 | 697 | if (attrs.socialshareVia) { 698 | urlString += '&via=' + encodeURIComponent(attrs.socialshareVia); 699 | } 700 | 701 | if (attrs.socialshareMedia) { 702 | urlString += '&picture=' + encodeURIComponent(attrs.socialshareMedia); 703 | } 704 | 705 | //default to the current page if a URL isn't specified 706 | urlString += '&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 707 | 708 | $window.open( 709 | urlString, 710 | 'Buffer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 711 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 712 | } 713 | , manageHackernewsShare = function manageHackernewsShare($window, attrs) { 714 | var urlString = 'https://news.ycombinator.com/submitlink?'; 715 | 716 | if (attrs.socialshareText) { 717 | urlString += 't=' + encodeURIComponent(attrs.socialshareText) + '&'; 718 | } 719 | //default to the current page if a URL isn't specified 720 | urlString += 'u=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 721 | 722 | $window.open( 723 | urlString, 724 | 'Hackernews', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 725 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 726 | } 727 | , manageFlipboardShare = function manageFlipboardShare($window, attrs) { 728 | var urlString = 'https://share.flipboard.com/bookmarklet/popout?v=2&'; 729 | 730 | if (attrs.socialshareText) { 731 | urlString += 'title=' + encodeURIComponent(attrs.socialshareText) + '&'; 732 | } 733 | 734 | //default to the current page if a URL isn't specified 735 | urlString += 'url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 736 | 737 | $window.open( 738 | urlString, 739 | 'Flipboard', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 740 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 741 | } 742 | , managePocketShare = function managePocketShare($window, attrs) { 743 | var urlString = 'https://getpocket.com/save?'; 744 | 745 | if (attrs.socialshareText) { 746 | urlString += 'text=' + encodeURIComponent(attrs.socialshareText) + '&'; 747 | } 748 | 749 | //default to the current page if a URL isn't specified 750 | urlString += 'url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 751 | 752 | $window.open( 753 | urlString, 754 | 'Pocket', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 755 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 756 | } 757 | , manageWordpressShare = function manageWordpressShare($window, attrs) { 758 | var urlString = 'http://wordpress.com/press-this.php?'; 759 | 760 | if (attrs.socialshareText) { 761 | urlString += 't=' + encodeURIComponent(attrs.socialshareText) + '&'; 762 | } 763 | if (attrs.socialshareMedia) { 764 | urlString += 'i=' + encodeURIComponent(attrs.socialshareMedia) + '&'; 765 | } 766 | 767 | //default to the current page if a URL isn't specified 768 | urlString += 'u=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 769 | 770 | $window.open( 771 | urlString, 772 | 'Wordpress', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 773 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 774 | } 775 | , manageXingShare = function manageXingShare($window, attrs) { 776 | var followUrl = ''; 777 | 778 | if (attrs.socialshareFollow) { 779 | followUrl = '&follow_url=' + encodeURIComponent(attrs.socialshareFollow); 780 | } 781 | $window.open( 782 | 'https://www.xing.com/spi/shares/new?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + followUrl 783 | , 'Xing', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 784 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 785 | } 786 | , manageEvernoteShare = function manageEvernoteShare($window, attrs) { 787 | 788 | var urlString = 'http://www.evernote.com/clip.action?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 789 | 790 | if (attrs.socialshareText) { 791 | urlString += '&title=' + encodeURIComponent(attrs.socialshareText); 792 | } 793 | 794 | $window.open( 795 | urlString 796 | , 'Evernote', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 797 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 798 | } 799 | , manageWhatsappShare = function manageWhatsappShare($window, attrs, element) { 800 | 801 | var href = 'whatsapp://send?text=' + encodeURIComponent(attrs.socialshareText) + '%0A' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 802 | 803 | element.attr('href', href); 804 | element.attr('target', '_top'); 805 | 806 | } 807 | , manageSmsShare = function smsShare($window, attrs, element) { 808 | 809 | if (attrs.socialshareText.indexOf('%') >= 0) { 810 | $log.warn('sending sms text with "%" sign is not supported'); 811 | } 812 | 813 | var body = encodeURIComponent(attrs.socialshareText.replace('%','')) 814 | , toPhoneNumber = attrs.socialshareTo || '' 815 | , urlString; 816 | 817 | if (attrs.socialshareUrl) { 818 | body += encodeURIComponent(attrs.socialshareUrl); 819 | } 820 | 821 | urlString = 'sms:' + toPhoneNumber + '?&body=' + body; 822 | 823 | element.attr('href', urlString); 824 | element.attr('target', '_blank'); 825 | } 826 | , manageViberShare = function manageViberShare($window, attrs, element) { 827 | 828 | var href = 'viber://forward?text=' + encodeURIComponent(attrs.socialshareText) + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 829 | 830 | element.attr('href', href); 831 | element.attr('target', '_top'); 832 | } 833 | , manageTelegramShare = function manageTelegramShare($window, attrs) { 834 | 835 | var urlString = 'https://telegram.me/share/url?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 836 | 837 | if (attrs.socialshareText) { 838 | urlString += '&text=' + encodeURIComponent(attrs.socialshareText); 839 | } 840 | 841 | $window.open( 842 | urlString 843 | , 'Telegram', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 844 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 845 | } 846 | , skypeShare = function skypeShare($window, attrs) { 847 | var urlString = 'https://web.skype.com/share?source=button&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 848 | 849 | if (attrs.socialshareText) { 850 | urlString += '&text=' + encodeURIComponent(attrs.socialshareText); 851 | } 852 | 853 | $window.open( 854 | urlString 855 | , 'Skype', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 856 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 857 | } 858 | , weiboShare = function weiboShare($window, attrs) { 859 | var urlString = 'http://service.weibo.com/share/share.php?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 860 | 861 | if (attrs.socialshareText) { 862 | urlString += '&title=' + encodeURIComponent(attrs.socialshareText); 863 | } 864 | 865 | $window.open( 866 | urlString 867 | , 'Weibo', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 868 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 869 | } 870 | , socialshareService = /*@ngInject*/ ['$window', '$log', function socialshareService($window, $log) { 871 | 872 | this.emailShare = manageEmailShare; 873 | this.facebookShare = manageFacebookShare; 874 | this.twitterShare = manageTwitterShare; 875 | //**** Fb Messenger can't open without an element clicked (href) 876 | //this.facebookMessengerShare = facebookMessengerShare; 877 | this.stumbleuponShare = manageStumbleuponShare; 878 | this.pinterestShare = managePinterestShare; 879 | this.googleShare = manageGooglePlusShare; 880 | this.bufferShare = manageBufferShare; 881 | this.hackernewsShare = manageHackernewsShare; 882 | this.okShare = manageOkShare; 883 | this.deliciousShare = manageDeliciousShare; 884 | this.pocketShare = managePocketShare; 885 | this.vkShare = manageVkShare; 886 | this.flipboardShare = manageFlipboardShare; 887 | this.xingShare = manageXingShare; 888 | this.diggShare = manageDiggShare; 889 | this.linkedinShare = manageLinkedinShare; 890 | this.wordpressShare = manageWordpressShare; 891 | this.telegramShare = manageTelegramShare; 892 | this.redditShare = manageRedditShare; 893 | this.evernoteShare = manageEvernoteShare; 894 | this.tumblrShare = manageTumblrShare; 895 | //**** viber can't share without an element clicked (href) 896 | //this.viberShare = manageViberShare; 897 | //**** whatsapp can't share without an element clicked (href) 898 | //this.whatsappShare = manageWhatsappShare; 899 | this.skypeShare = skypeShare; 900 | this.smsShare = manageSmsShare; 901 | this.weiboShare = weiboShare; 902 | 903 | this.share = function shareTrigger(serviceShareConf) { 904 | 905 | switch (serviceShareConf.provider) { 906 | case 'email': { 907 | this.emailShare($window, serviceShareConf.attrs); 908 | break; 909 | } 910 | case 'sms': { 911 | this.smsShare($window, $log, serviceShareConf.attrs); 912 | break; 913 | } 914 | case 'facebook': { 915 | this.facebookShare($window, serviceShareConf.attrs); 916 | break; 917 | } 918 | case 'twitter': { 919 | this.twitterShare($window, serviceShareConf.attrs); 920 | break; 921 | } 922 | case 'pinterest': { 923 | this.pinterestShare($window, serviceShareConf.attrs); 924 | break; 925 | } 926 | case 'ok': { 927 | this.okShare($window, serviceShareConf.attrs); 928 | break; 929 | } 930 | case 'vk': { 931 | this.vkShare($window, serviceShareConf.attrs); 932 | break; 933 | } 934 | case 'delicious': { 935 | this.deliciousShare($window, serviceShareConf.attrs); 936 | break; 937 | } 938 | case 'digg': { 939 | this.diggShare($window, serviceShareConf.attrs); 940 | break; 941 | } 942 | case 'google': { 943 | this.googleShare($window, serviceShareConf.attrs); 944 | break; 945 | } 946 | case 'reddit': { 947 | this.redditShare($window, serviceShareConf.attrs); 948 | break; 949 | } 950 | case 'hackernews': { 951 | this.hackernewsShare($window, serviceShareConf.attrs); 952 | break; 953 | } 954 | case 'skype': { 955 | this.skypeShare($window, serviceShareConf.attrs); 956 | break; 957 | } 958 | case 'evernote': { 959 | this.evernoteShare($window, serviceShareConf.attrs); 960 | break; 961 | } 962 | case 'pocket': { 963 | this.pocketShare($window, serviceShareConf.attrs); 964 | break; 965 | } 966 | case 'tumblr': { 967 | this.tumblrShare($window, serviceShareConf.attrs); 968 | break; 969 | } 970 | case 'telegram': { 971 | this.telegramShare($window, serviceShareConf.attrs); 972 | break; 973 | } 974 | case 'xing': { 975 | this.xingShare($window, serviceShareConf.attrs); 976 | break; 977 | } 978 | case 'buffer': { 979 | this.bufferShare($window, serviceShareConf.attrs); 980 | break; 981 | } 982 | case 'stumbleupon': { 983 | this.stumbleuponShare($window, serviceShareConf.attrs); 984 | break; 985 | } 986 | case 'linkedin': { 987 | this.linkedinShare($window, serviceShareConf.attrs); 988 | break; 989 | } 990 | case 'wordpress': { 991 | this.wordpressShare($window, serviceShareConf.attrs); 992 | break; 993 | } 994 | case 'flipboard': { 995 | this.flipboardShare($window, serviceShareConf.attrs); 996 | break; 997 | } 998 | case 'weibo': { 999 | this.weiboShare($window, serviceShareConf.attrs); 1000 | break; 1001 | } 1002 | default: { 1003 | return; 1004 | } 1005 | } 1006 | }; 1007 | }] 1008 | , socialshareDirective = /*@ngInject*/ ['$window', 'socialshareConf', 'Socialshare', '$log', function socialshareDirective($window, socialshareConf, $log) { 1009 | 1010 | var linkingFunction = function linkingFunction($scope, element, attrs) { 1011 | 1012 | // observe the values in each of the properties so that if they're updated elsewhere, 1013 | // they are updated in this directive. 1014 | var configurationElement 1015 | , index = 0 1016 | , onEventTriggered = function onEventTriggered() { 1017 | /*eslint-disable no-use-before-define*/ 1018 | if (attrs.socialshareProvider in sharingFunctions) { 1019 | sharingFunctions[attrs.socialshareProvider]($window, attrs, element); 1020 | } else { 1021 | return true; 1022 | } 1023 | }; 1024 | /*eslint-enable no-use-before-define*/ 1025 | //looking into configuration if there is a config for the current provider 1026 | for (; index < socialshareConf.length; index += 1) { 1027 | if (socialshareConf[index].provider === attrs.socialshareProvider) { 1028 | configurationElement = socialshareConf[index]; 1029 | break; 1030 | } 1031 | } 1032 | 1033 | if (socialshareProviderNames.indexOf(configurationElement.provider) === -1) { 1034 | $log.warn('Invalid Provider Name : ' + attrs.socialshareProvider); 1035 | } 1036 | 1037 | //if some attribute is not define provide a default one 1038 | attrs.socialshareMobileiframe = attrs.socialshareMobileiframe || configurationElement.conf.mobile_iframe; 1039 | attrs.socialshareQuote = attrs.socialshareQuote || configurationElement.conf.quote; 1040 | attrs.socialshareTitle = attrs.socialshareTitle || configurationElement.conf.title; 1041 | attrs.socialshareUrl = attrs.socialshareUrl || configurationElement.conf.url || configurationElement.conf.href; 1042 | attrs.socialshareText = attrs.socialshareText || configurationElement.conf.text; 1043 | attrs.socialshareMedia = attrs.socialshareMedia || configurationElement.conf.media; 1044 | attrs.socialshareType = attrs.socialshareType || configurationElement.conf.type; 1045 | attrs.socialshareVia = attrs.socialshareVia || configurationElement.conf.via; 1046 | attrs.socialshareTo = attrs.socialshareTo || configurationElement.conf.to; 1047 | attrs.socialshareFrom = attrs.socialshareFrom || configurationElement.conf.from; 1048 | attrs.socialshareRef = attrs.socialshareRef || configurationElement.conf.ref; 1049 | attrs.socialshareDislay = attrs.socialshareDislay || configurationElement.conf.display; 1050 | attrs.socialshareSource = attrs.socialshareSource || configurationElement.conf.source; 1051 | attrs.socialshareCaption = attrs.socialshareCaption || configurationElement.conf.caption; 1052 | attrs.socialshareRedirectUri = attrs.socialshareRedirectUri || configurationElement.conf.redirectUri; 1053 | attrs.socialshareTrigger = attrs.socialshareTrigger || configurationElement.conf.trigger; 1054 | attrs.socialsharePopupHeight = attrs.socialsharePopupHeight || configurationElement.conf.popupHeight; 1055 | attrs.socialsharePopupWidth = attrs.socialsharePopupWidth || configurationElement.conf.popupWidth; 1056 | attrs.socialshareSubreddit = attrs.socialshareSubreddit || configurationElement.conf.subreddit; 1057 | attrs.socialshareDescription = attrs.socialshareDescription || configurationElement.conf.description; 1058 | attrs.socialshareFollow = attrs.socialshareFollow || configurationElement.conf.follow; 1059 | attrs.socialshareHashtags = attrs.socialshareHashtags || configurationElement.conf.hashtags; 1060 | attrs.socialshareBody = attrs.socialshareBody || configurationElement.conf.body; 1061 | attrs.socialshareSubject = attrs.socialshareSubject || configurationElement.conf.subject; 1062 | attrs.socialshareCc = attrs.socialshareCc || configurationElement.conf.cc; 1063 | attrs.socialshareBcc = attrs.socialshareBcc || configurationElement.conf.bcc; 1064 | 1065 | if (attrs.socialshareTrigger) { 1066 | 1067 | element.bind(attrs.socialshareTrigger, onEventTriggered); 1068 | } else { 1069 | 1070 | onEventTriggered(); 1071 | } 1072 | }; 1073 | 1074 | return { 1075 | 'restrict': 'A', 1076 | 'link': linkingFunction 1077 | }; 1078 | }] 1079 | , sharingFunctions = { 1080 | 'email': manageEmailShare 1081 | , 'facebook': manageFacebookShare 1082 | , 'facebook-messenger': facebookMessengerShare 1083 | , 'twitter': manageTwitterShare 1084 | , 'google': manageGooglePlusShare 1085 | , 'reddit': manageRedditShare 1086 | , 'stumbleupon': manageStumbleuponShare 1087 | , 'linkedin': manageLinkedinShare 1088 | , 'pinterest': managePinterestShare 1089 | , 'digg': manageDiggShare 1090 | , 'tumblr': manageTumblrShare 1091 | , 'vk': manageVkShare 1092 | , 'ok': manageOkShare 1093 | , 'delicious': manageDeliciousShare 1094 | , 'buffer': manageBufferShare 1095 | , 'hackernews': manageHackernewsShare 1096 | , 'flipboard': manageFlipboardShare 1097 | , 'pocket': managePocketShare 1098 | , 'wordpress': manageWordpressShare 1099 | , 'xing': manageXingShare 1100 | , 'evernote': manageEvernoteShare 1101 | , 'whatsapp': manageWhatsappShare 1102 | , 'sms': manageSmsShare 1103 | , 'telegram': manageTelegramShare 1104 | , 'viber': manageViberShare 1105 | , 'skype': skypeShare 1106 | , 'weibo': weiboShare 1107 | }; 1108 | 1109 | 1110 | angular.module('720kb.socialshare', []) 1111 | .provider(directiveName + 'Conf', socialshareConfigurationProvider) 1112 | .service(serviceName, socialshareService) 1113 | .directive(directiveName, socialshareDirective); 1114 | }(angular)); 1115 | -------------------------------------------------------------------------------- /dist/angular-socialshare.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["angular-socialshare.js"],"names":["angular","directiveName","serviceName","socialshareProviderNames","socialshareConfigurationProvider","socialshareConfigurationDefault","provider","conf","subject","body","to","cc","bcc","trigger","url","title","href","quote","hashtags","text","media","mobile_iframe","type","via","from","ref","display","source","caption","redirectUri","popupHeight","popupWidth","description","subreddit","follow","configure","configuration","configurationKeys","configurationIndex","aConfigurationKey","configElement","configIndex","internIndex","$log","injector","get","length","indexOf","Object","keys","warn","$get","manageFacebookShare","$window","attrs","urlString","socialshareType","socialshareVia","encodeURIComponent","socialshareRedirectUri","socialshareUrl","socialshareTo","socialshareDisplay","socialshareRef","socialshareFrom","socialshareSource","open","socialsharePopupWidth","socialsharePopupHeight","innerHeight","innerWidth","socialshareQuote","socialshareMobileiframe","socialshareHashtags","location","manageEmailShare","socialshareBody","socialshareSubject","socialshareCc","socialshareBcc","self","top","facebookMessengerShare","element","attr","manageTwitterShare","socialshareText","manageGooglePlusShare","manageRedditShare","socialshareSubreddit","manageStumbleuponShare","manageLinkedinShare","socialshareDescription","managePinterestShare","socialshareMedia","manageDiggShare","manageTumblrShare","manageVkShare","manageOkShare","manageDeliciousShare","manageBufferShare","manageHackernewsShare","manageFlipboardShare","managePocketShare","manageWordpressShare","manageXingShare","followUrl","socialshareFollow","manageEvernoteShare","manageWhatsappShare","manageSmsShare","replace","toPhoneNumber","manageViberShare","manageTelegramShare","skypeShare","weiboShare","socialshareService","this","emailShare","facebookShare","twitterShare","stumbleuponShare","pinterestShare","googleShare","bufferShare","hackernewsShare","okShare","deliciousShare","pocketShare","vkShare","flipboardShare","xingShare","diggShare","linkedinShare","wordpressShare","telegramShare","redditShare","evernoteShare","tumblrShare","smsShare","share","serviceShareConf","socialshareDirective","socialshareConf","linkingFunction","$scope","configurationElement","index","onEventTriggered","socialshareProvider","sharingFunctions","socialshareTitle","socialshareDislay","socialshareCaption","socialshareTrigger","bind","restrict","link","email","facebook","facebook-messenger","twitter","google","reddit","stumbleupon","linkedin","pinterest","digg","tumblr","vk","ok","delicious","buffer","hackernews","flipboard","pocket","wordpress","xing","evernote","whatsapp","sms","telegram","viber","skype","weibo","module","service","directive"],"mappings":";;;;;;;;;;CAaC,SAAqBA,GACpB,YAEA,IAAIC,GAAgB,cAChBC,EAAc,cACdC,GAA4B,WAAY,qBAAqB,MAAO,UAAW,WAAY,SAAU,YAAa,SAAU,SAAU,cAAe,SAAU,OAAQ,YAAa,KAAM,SAAU,YAAa,YAAa,OAAQ,aAAc,WAAY,WAAY,WAAY,QAAS,QAAS,QAAS,KAAM,SACzTC,EAAiD,WAEjD,GAAIC,KACFC,SAAY,QACZC,MACEC,QAAW,G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EAAMuB,oBAAsBsE,EAAqB5I,KAAKC,QACjF8C,EAAMwB,cAAgBxB,EAAMwB,eAAiBqE,EAAqB5I,KAAKI,GACvE2C,EAAMyB,eAAiBzB,EAAMyB,gBAAkBoE,EAAqB5I,KAAKK,IAErE0C,EAAMqG,mBAERxE,EAAQyE,KAAKtG,EAAMqG,mBAAoBN,GAGvCA,IAIJ,QACEQ,SAAY,IACZC,KAAQb,KAGVM,GACEQ,MAASpF,EACTqF,SAAY5G,EACZ6G,qBAAsB/E,EACtBgF,QAAW7E,EACX8E,OAAU5E,EACV6E,OAAU5E,EACV6E,YAAe3E,EACf4E,SAAY3E,EACZ4E,UAAa1E,EACb2E,KAAQzE,EACR0E,OAAUzE,EACV0E,GAAMzE,EACN0E,GAAMzE,EACN0E,UAAazE,EACb0E,OAAUzE,EACV0E,WAAczE,EACd0E,UAAazE,EACb0E,OAAUzE,EACV0E,UAAazE,EACb0E,KAAQzE,EACR0E,SAAYvE,EACZwE,SAAYvE,EACZwE,IAAOvE,EACPwE,SAAYpE,EACZqE,MAAStE,EACTuE,MAASrE,EACTsE,MAASrE,EAIfpH,GAAQ0L,OAAO,wBACdpL,SAASL,EAAgB,OAAQG,GACjCuL,QAAQzL,EAAamH,GACrBuE,UAAU3L,EAAe8I,IAC1B/I","file":"angular-socialshare.js","sourceRoot":"../lib"} -------------------------------------------------------------------------------- /dist/angular-socialshare.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * angular-socialshare 3 | * 2.3.11 4 | * 5 | * A social media url and content share module for angularjs. 6 | * http://720kb.github.io/angular-socialshare 7 | * 8 | * MIT license 9 | * Fri Jun 23 2017 10 | */ 11 | !function(e){"use strict";var o="socialshare",i="Socialshare",a=["facebook","facebook-messenger","sms","twitter","linkedin","google","pinterest","tumblr","reddit","stumbleupon","buffer","digg","delicious","vk","pocket","wordpress","flipboard","xing","hackernews","evernote","whatsapp","telegram","viber","skype","email","ok","weibo"],t=function(){var o=[{provider:"email",conf:{subject:"",body:"",to:"",cc:"",bcc:"",trigger:"click"}},{provider:"facebook",conf:{url:"",title:"",href:"",quote:"",hashtags:"",text:"",media:"",mobile_iframe:"",type:"",via:"",to:"",from:"",ref:"",display:"",source:"",caption:"",redirectUri:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"facebook-messenger",conf:{url:""}},{provider:"twitter",conf:{url:"",text:"",via:"",hashtags:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"linkedin",conf:{url:"",text:"",description:"",source:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"reddit",conf:{url:"",text:"",subreddit:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"vk",conf:{url:"",text:"",media:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"ok",conf:{url:"",text:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"digg",conf:{url:"",text:"",media:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"delicious",conf:{url:"",text:"",media:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"stumbleupon",conf:{url:"",text:"",media:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"pinterest",conf:{url:"",text:"",media:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"google",conf:{url:"",text:"",media:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"tumblr",conf:{url:"",text:"",media:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"buffer",conf:{url:"",text:"",via:"",media:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"pocket",conf:{url:"",text:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"flipboard",conf:{url:"",text:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"hackernews",conf:{url:"",text:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"wordpress",conf:{url:"",text:"",media:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"xing",conf:{url:"",text:"",media:"",follow:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"evernote",conf:{url:"",text:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"whatsapp",conf:{url:"",text:""}},{provider:"sms",conf:{url:"",text:"",to:"",trigger:"click"}},{provider:"telegram",conf:{url:"",text:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"viber",conf:{url:"",text:""}},{provider:"skype",conf:{url:"",text:"",trigger:"click",popupHeight:600,popupWidth:500}},{provider:"weibo",conf:{url:"",text:"",trigger:"click",popupHeight:600,popupWidth:500}}];return{configure:function(i){var t,s,r,h,c=0,p=0,n=e.injector(["ng"]).get("$log");if(i&&i.length>0)for(;c-1){for(;p=0&&$log.warn('sending sms text with "%" sign is not supported');var a,t=encodeURIComponent(o.socialshareText.replace("%","")),s=o.socialshareTo||"";o.socialshareUrl&&(t+=encodeURIComponent(o.socialshareUrl)),a="sms:"+s+"?&body="+t,i.attr("href",a),i.attr("target","_blank")},x=function(e,o,i){var a="viber://forward?text="+encodeURIComponent(o.socialshareText)+encodeURIComponent(o.socialshareUrl||e.location.href);i.attr("href",a),i.attr("target","_top")},y=function(e,o){var i="https://telegram.me/share/url?url="+encodeURIComponent(o.socialshareUrl||e.location.href);o.socialshareText&&(i+="&text="+encodeURIComponent(o.socialshareText)),e.open(i,"Telegram","toolbar=0,status=0,resizable=yes,width="+o.socialsharePopupWidth+",height="+o.socialsharePopupHeight+",top="+(e.innerHeight-o.socialsharePopupHeight)/2+",left="+(e.innerWidth-o.socialsharePopupWidth)/2)},S=function(e,o){var i="https://web.skype.com/share?source=button&url="+encodeURIComponent(o.socialshareUrl||e.location.href);o.socialshareText&&(i+="&text="+encodeURIComponent(o.socialshareText)),e.open(i,"Skype","toolbar=0,status=0,resizable=yes,width="+o.socialsharePopupWidth+",height="+o.socialsharePopupHeight+",top="+(e.innerHeight-o.socialsharePopupHeight)/2+",left="+(e.innerWidth-o.socialsharePopupWidth)/2)},T=function(e,o){var i="http://service.weibo.com/share/share.php?url="+encodeURIComponent(o.socialshareUrl||e.location.href);o.socialshareText&&(i+="&title="+encodeURIComponent(o.socialshareText)),e.open(i,"Weibo","toolbar=0,status=0,resizable=yes,width="+o.socialsharePopupWidth+",height="+o.socialsharePopupHeight+",top="+(e.innerHeight-o.socialsharePopupHeight)/2+",left="+(e.innerWidth-o.socialsharePopupWidth)/2)},z=["$window","$log",function(e,o){this.emailShare=r,this.facebookShare=s,this.twitterShare=c,this.stumbleuponShare=l,this.pinterestShare=u,this.googleShare=p,this.bufferShare=U,this.hackernewsShare=k,this.okShare=b,this.deliciousShare=w,this.pocketShare=H,this.vkShare=m,this.flipboardShare=P,this.xingShare=v,this.diggShare=g,this.linkedinShare=d,this.wordpressShare=W,this.telegramShare=y,this.redditShare=n,this.evernoteShare=R,this.tumblrShare=f,this.skypeShare=S,this.smsShare=I,this.weiboShare=T,this.share=function(i){switch(i.provider){case"email":this.emailShare(e,i.attrs);break;case"sms":this.smsShare(e,o,i.attrs);break;case"facebook":this.facebookShare(e,i.attrs);break;case"twitter":this.twitterShare(e,i.attrs);break;case"pinterest":this.pinterestShare(e,i.attrs);break;case"ok":this.okShare(e,i.attrs);break;case"vk":this.vkShare(e,i.attrs);break;case"delicious":this.deliciousShare(e,i.attrs);break;case"digg":this.diggShare(e,i.attrs);break;case"google":this.googleShare(e,i.attrs);break;case"reddit":this.redditShare(e,i.attrs);break;case"hackernews":this.hackernewsShare(e,i.attrs);break;case"skype":this.skypeShare(e,i.attrs);break;case"evernote":this.evernoteShare(e,i.attrs);break;case"pocket":this.pocketShare(e,i.attrs);break;case"tumblr":this.tumblrShare(e,i.attrs);break;case"telegram":this.telegramShare(e,i.attrs);break;case"xing":this.xingShare(e,i.attrs);break;case"buffer":this.bufferShare(e,i.attrs);break;case"stumbleupon":this.stumbleuponShare(e,i.attrs);break;case"linkedin":this.linkedinShare(e,i.attrs);break;case"wordpress":this.wordpressShare(e,i.attrs);break;case"flipboard":this.flipboardShare(e,i.attrs);break;case"weibo":this.weiboShare(e,i.attrs);break;default:return}}}],_=["$window","socialshareConf","Socialshare","$log",function(e,o,i){var t=function(t,s,r){for(var h,c=0,p=(function(){return!(r.socialshareProvider in D)||void D[r.socialshareProvider](e,r,s)});c 2 | 3 | 4 | 6 | 7 | Angularjs Socialshare 8 | 9 | 10 | 11 |
12 |
13 | {{test.testValue}} 14 |
15 |
16 |
17 |
18 | 30 |
31 |
32 |
33 | 44 |
45 |
46 |
47 | 64 |
65 |
66 |
67 | 84 |
85 |
86 |
87 | 99 |
100 |
101 |
102 | 106 | Share on Facebook Messenger (iOs and Android only) 107 | 108 |
109 |
110 | 122 |
123 | 128 |
129 |
130 |
131 | 140 |
141 |
142 |
143 | 153 |
154 |
155 | 160 |
161 |
162 | 172 |
173 |
174 |
175 | 187 |
188 |
189 |
190 | 201 |
202 |
203 |
204 | 214 |
215 |
216 |
217 | 228 |
229 |
230 |
231 | 242 |
243 |
244 |
245 | 255 |
256 |
257 |
258 | 268 |
269 |
270 |
271 | 281 |
282 |
283 |
284 | 296 |
297 |
298 |
299 | 310 |
311 |
312 |
313 | 324 |
325 |
326 |
327 | 337 |
338 |
339 |
340 | 352 |
353 |
354 |
355 | 365 |
366 |
367 |
368 | 378 |
379 |
380 | 389 |
390 | 399 | 400 |
401 |
402 | 410 |
411 |
412 | 421 |
422 |
423 | 433 |
434 |
435 |
436 |
437 | 438 | 440 | 441 | 442 | 443 | 444 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | (function commonJS(require, module) { 2 | 'use strict'; 3 | 4 | require('./dist/angular-socialshare'); 5 | 6 | module.exports = '720kb.socialshare'; 7 | }(require, module)); 8 | -------------------------------------------------------------------------------- /lib/angular-socialshare.js: -------------------------------------------------------------------------------- 1 | /*global angular*/ 2 | /*eslint no-loop-func:0, func-names:0*/ 3 | 4 | (function withAngular(angular) { 5 | 'use strict'; 6 | 7 | var directiveName = 'socialshare' 8 | , serviceName = 'Socialshare' 9 | , socialshareProviderNames = ['facebook', 'facebook-messenger','sms', 'twitter', 'linkedin', 'google', 'pinterest', 'tumblr', 'reddit', 'stumbleupon', 'buffer', 'digg', 'delicious', 'vk', 'pocket', 'wordpress', 'flipboard', 'xing', 'hackernews', 'evernote', 'whatsapp', 'telegram', 'viber', 'skype', 'email', 'ok', 'weibo'] 10 | , socialshareConfigurationProvider = /*@ngInject*/ function socialshareConfigurationProvider() { 11 | 12 | var socialshareConfigurationDefault = [{ 13 | 'provider': 'email', 14 | 'conf': { 15 | 'subject': '', 16 | 'body': '', 17 | 'to': '', 18 | 'cc': '', 19 | 'bcc': '', 20 | 'trigger': 'click' 21 | } 22 | }, 23 | { 24 | 'provider': 'facebook', 25 | 'conf': { 26 | 'url':'', 27 | 'title':'', 28 | 'href':'', 29 | 'quote':'', 30 | 'hashtags':'', 31 | 'text': '', 32 | 'media': '', 33 | 'mobile_iframe': '', 34 | 'type': '', 35 | 'via': '', 36 | 'to': '', 37 | 'from': '', 38 | 'ref': '', 39 | 'display': '', 40 | 'source': '', 41 | 'caption': '', 42 | 'redirectUri': '', 43 | 'trigger': 'click', 44 | 'popupHeight': 600, 45 | 'popupWidth': 500 46 | } 47 | }, 48 | { 49 | 'provider': 'facebook-messenger', 50 | 'conf': { 51 | 'url': '' 52 | } 53 | }, 54 | { 55 | 'provider': 'twitter', 56 | 'conf': { 57 | 'url': '', 58 | 'text': '', 59 | 'via': '', 60 | 'hashtags': '', 61 | 'trigger': 'click', 62 | 'popupHeight': 600, 63 | 'popupWidth': 500 64 | } 65 | }, 66 | { 67 | 'provider': 'linkedin', 68 | 'conf': { 69 | 'url': '', 70 | 'text': '', 71 | 'description': '', 72 | 'source': '', 73 | 'trigger': 'click', 74 | 'popupHeight': 600, 75 | 'popupWidth': 500 76 | } 77 | }, 78 | { 79 | 'provider': 'reddit', 80 | 'conf': { 81 | 'url': '', 82 | 'text': '', 83 | 'subreddit': '', 84 | 'trigger': 'click', 85 | 'popupHeight': 600, 86 | 'popupWidth': 500 87 | } 88 | }, 89 | { 90 | 'provider': 'vk', 91 | 'conf': { 92 | 'url': '', 93 | 'text': '', 94 | 'media': '', 95 | 'trigger': 'click', 96 | 'popupHeight': 600, 97 | 'popupWidth': 500 98 | } 99 | }, 100 | { 101 | 'provider': 'ok', 102 | 'conf': { 103 | 'url': '', 104 | 'text': '', 105 | 'trigger': 'click', 106 | 'popupHeight': 600, 107 | 'popupWidth': 500 108 | } 109 | }, 110 | { 111 | 'provider': 'digg', 112 | 'conf': { 113 | 'url': '', 114 | 'text': '', 115 | 'media': '', 116 | 'trigger': 'click', 117 | 'popupHeight': 600, 118 | 'popupWidth': 500 119 | } 120 | }, 121 | { 122 | 'provider': 'delicious', 123 | 'conf': { 124 | 'url': '', 125 | 'text': '', 126 | 'media': '', 127 | 'trigger': 'click', 128 | 'popupHeight': 600, 129 | 'popupWidth': 500 130 | } 131 | }, 132 | { 133 | 'provider': 'stumbleupon', 134 | 'conf': { 135 | 'url': '', 136 | 'text': '', 137 | 'media': '', 138 | 'trigger': 'click', 139 | 'popupHeight': 600, 140 | 'popupWidth': 500 141 | } 142 | }, 143 | { 144 | 'provider': 'pinterest', 145 | 'conf': { 146 | 'url': '', 147 | 'text': '', 148 | 'media': '', 149 | 'trigger': 'click', 150 | 'popupHeight': 600, 151 | 'popupWidth': 500 152 | } 153 | }, 154 | { 155 | 'provider': 'google', 156 | 'conf': { 157 | 'url': '', 158 | 'text': '', 159 | 'media': '', 160 | 'trigger': 'click', 161 | 'popupHeight': 600, 162 | 'popupWidth': 500 163 | } 164 | }, 165 | { 166 | 'provider': 'tumblr', 167 | 'conf': { 168 | 'url': '', 169 | 'text': '', 170 | 'media': '', 171 | 'trigger': 'click', 172 | 'popupHeight': 600, 173 | 'popupWidth': 500 174 | } 175 | }, 176 | { 177 | 'provider': 'buffer', 178 | 'conf': { 179 | 'url': '', 180 | 'text': '', 181 | 'via': '', 182 | 'media': '', 183 | 'trigger': 'click', 184 | 'popupHeight': 600, 185 | 'popupWidth': 500 186 | } 187 | }, 188 | { 189 | 'provider': 'pocket', 190 | 'conf': { 191 | 'url': '', 192 | 'text': '', 193 | 'trigger': 'click', 194 | 'popupHeight': 600, 195 | 'popupWidth': 500 196 | } 197 | }, 198 | { 199 | 'provider': 'flipboard', 200 | 'conf': { 201 | 'url': '', 202 | 'text': '', 203 | 'trigger': 'click', 204 | 'popupHeight': 600, 205 | 'popupWidth': 500 206 | } 207 | }, 208 | { 209 | 'provider': 'hackernews', 210 | 'conf': { 211 | 'url': '', 212 | 'text': '', 213 | 'trigger': 'click', 214 | 'popupHeight': 600, 215 | 'popupWidth': 500 216 | } 217 | }, 218 | { 219 | 'provider': 'wordpress', 220 | 'conf': { 221 | 'url': '', 222 | 'text': '', 223 | 'media': '', 224 | 'trigger': 'click', 225 | 'popupHeight': 600, 226 | 'popupWidth': 500 227 | } 228 | }, 229 | { 230 | 'provider': 'xing', 231 | 'conf': { 232 | 'url': '', 233 | 'text': '', 234 | 'media': '', 235 | 'follow' : '', 236 | 'trigger': 'click', 237 | 'popupHeight': 600, 238 | 'popupWidth': 500 239 | } 240 | }, 241 | { 242 | 'provider': 'evernote', 243 | 'conf': { 244 | 'url': '', 245 | 'text': '', 246 | 'trigger': 'click', 247 | 'popupHeight': 600, 248 | 'popupWidth': 500 249 | } 250 | }, 251 | { 252 | 'provider': 'whatsapp', 253 | 'conf': { 254 | 'url': '', 255 | 'text': '' 256 | } 257 | }, 258 | { 259 | 'provider': 'sms', 260 | 'conf': { 261 | 'url': '', 262 | 'text': '', 263 | 'to': '', 264 | 'trigger': 'click' 265 | } 266 | }, 267 | { 268 | 'provider': 'telegram', 269 | 'conf': { 270 | 'url': '', 271 | 'text': '', 272 | 'trigger': 'click', 273 | 'popupHeight': 600, 274 | 'popupWidth': 500 275 | } 276 | }, 277 | { 278 | 'provider': 'viber', 279 | 'conf': { 280 | 'url': '', 281 | 'text': '' 282 | } 283 | }, 284 | { 285 | 'provider': 'skype', 286 | 'conf': { 287 | 'url': '', 288 | 'text': '', 289 | 'trigger': 'click', 290 | 'popupHeight': 600, 291 | 'popupWidth': 500 292 | } 293 | }, 294 | { 295 | 'provider': 'weibo', 296 | 'conf': { 297 | 'url': '', 298 | 'text': '', 299 | 'trigger': 'click', 300 | 'popupHeight': 600, 301 | 'popupWidth': 500 302 | } 303 | }]; 304 | 305 | return { 306 | 'configure': function configure(configuration) { 307 | 308 | var configIndex = 0 309 | , configurationKeys 310 | , configurationIndex 311 | , aConfigurationKey 312 | , configElement 313 | , internIndex = 0 314 | //this is necessary becuase provider run before any service 315 | //so i have to take the log from another injector 316 | , $log = angular.injector(['ng']).get('$log'); 317 | 318 | if (configuration && configuration.length > 0) { 319 | for (; configIndex < configuration.length; configIndex += 1) { 320 | if (configuration[configIndex].provider && socialshareProviderNames.indexOf(configuration[configIndex].provider) > -1) { 321 | 322 | for (; internIndex < socialshareConfigurationDefault.length; internIndex += 1) { 323 | configElement = socialshareConfigurationDefault[internIndex]; 324 | 325 | if (configElement && 326 | configElement.provider && 327 | configuration[configIndex].provider === configElement.provider) { 328 | 329 | configurationKeys = Object.keys(configElement.conf); 330 | configurationIndex = 0; 331 | 332 | for (; configurationIndex < configurationKeys.length; configurationIndex += 1) { 333 | 334 | aConfigurationKey = configurationKeys[configurationIndex]; 335 | if (aConfigurationKey && configuration[configIndex].conf[aConfigurationKey]) { 336 | 337 | configElement.conf[aConfigurationKey] = configuration[configIndex].conf[aConfigurationKey]; 338 | } 339 | } 340 | 341 | // once the provider has been found and configuration applied 342 | // we should reset the internIndex for the next provider match to work correctly 343 | // and break, to skip loops on unwanted next providers 344 | internIndex = 0; 345 | break; 346 | } 347 | } 348 | } else { 349 | $log.warn('Invalid provider at element ' + configIndex + ' with name:' + configuration[configIndex].provider); 350 | } 351 | } 352 | } 353 | } 354 | , '$get': /*@ngInject*/ function instantiateProvider() { 355 | 356 | return socialshareConfigurationDefault; 357 | } 358 | }; 359 | } 360 | , manageFacebookShare = function manageFacebookShare($window, attrs) { 361 | 362 | var urlString; 363 | 364 | if (attrs.socialshareType && attrs.socialshareType === 'feed') { 365 | // if user specifies that they want to use the Facebook feed dialog 366 | //(https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.4) 367 | urlString = 'https://www.facebook.com/dialog/feed?'; 368 | 369 | if (attrs.socialshareVia) { 370 | urlString += '&app_id=' + encodeURIComponent(attrs.socialshareVia); 371 | } 372 | 373 | if (attrs.socialshareRedirectUri) { 374 | urlString += '&redirect_uri=' + encodeURIComponent(attrs.socialshareRedirectUri); 375 | } 376 | if (attrs.socialshareUrl) { 377 | urlString += '&link=' + encodeURIComponent(attrs.socialshareUrl); 378 | } 379 | 380 | if (attrs.socialshareTo) { 381 | urlString += '&to=' + encodeURIComponent(attrs.socialshareTo); 382 | } 383 | 384 | if (attrs.socialshareDisplay) { 385 | urlString += '&display=' + encodeURIComponent(attrs.socialshareDisplay); 386 | } 387 | 388 | if (attrs.socialshareRef) { 389 | urlString += '&ref=' + encodeURIComponent(attrs.socialshareRef); 390 | } 391 | 392 | if (attrs.socialshareFrom) { 393 | urlString += '&from=' + encodeURIComponent(attrs.socialshareFrom); 394 | } 395 | 396 | if (attrs.socialshareSource) { 397 | urlString += '&source=' + encodeURIComponent(attrs.socialshareSource); 398 | } 399 | 400 | $window.open( 401 | urlString, 402 | 'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 403 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 404 | 405 | } else if (attrs.socialshareType && attrs.socialshareType === 'share') { 406 | // if user specifies that they want to use the Facebook share dialog 407 | //(https://developers.facebook.com/docs/sharing/reference/share-dialog) 408 | urlString = 'https://www.facebook.com/dialog/share?'; 409 | 410 | if (attrs.socialshareVia) { 411 | urlString += '&app_id=' + encodeURIComponent(attrs.socialshareVia); 412 | } 413 | 414 | if (attrs.socialshareRedirectUri) { 415 | urlString += '&redirect_uri=' + encodeURIComponent(attrs.socialshareRedirectUri); 416 | } 417 | 418 | if (attrs.socialshareUrl) { 419 | urlString += '&href=' + encodeURIComponent(attrs.socialshareUrl); 420 | } 421 | 422 | if (attrs.socialshareQuote) { 423 | urlString += '"e=' + encodeURIComponent(attrs.socialshareQuote); 424 | } 425 | 426 | if (attrs.socialshareDisplay) { 427 | urlString += '&display=' + encodeURIComponent(attrs.socialshareDisplay); 428 | } 429 | 430 | if (attrs.socialshareMobileiframe) { 431 | urlString += '&mobile_iframe=' + encodeURIComponent(attrs.socialshareMobileiframe); 432 | } 433 | 434 | if (attrs.socialshareHashtags) { 435 | urlString += '&hashtag=' + encodeURIComponent(attrs.socialshareHashtags); 436 | } 437 | 438 | 439 | $window.open( 440 | urlString, 441 | 'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 442 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 443 | 444 | } else if (attrs.socialshareType && attrs.socialshareType === 'send') { 445 | // if user specifies that they want to use the Facebook send dialog 446 | //(https://developers.facebook.com/docs/sharing/reference/send-dialog) 447 | urlString = 'https://www.facebook.com/dialog/send?'; 448 | 449 | if (attrs.socialshareVia) { 450 | urlString += '&app_id=' + encodeURIComponent(attrs.socialshareVia); 451 | } 452 | 453 | if (attrs.socialshareRedirectUri) { 454 | urlString += '&redirect_uri=' + encodeURIComponent(attrs.socialshareRedirectUri); 455 | } 456 | 457 | if (attrs.socialshareUrl) { 458 | urlString += '&link=' + encodeURIComponent(attrs.socialshareUrl); 459 | } 460 | 461 | if (attrs.socialshareTo) { 462 | urlString += '&to=' + encodeURIComponent(attrs.socialshareTo); 463 | } 464 | 465 | if (attrs.socialshareDisplay) { 466 | urlString += '&display=' + encodeURIComponent(attrs.socialshareDisplay); 467 | } 468 | 469 | $window.open( 470 | urlString, 471 | 'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 472 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 473 | 474 | } else { 475 | //otherwise default to using sharer.php 476 | $window.open( 477 | 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) 478 | , 'Facebook', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 479 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 480 | } 481 | } 482 | , manageEmailShare = function manageEmailShare($window, attrs) { 483 | var urlString = 'mailto:'; 484 | 485 | if (attrs.socialshareTo) { 486 | 487 | urlString += encodeURIComponent(attrs.socialshareTo); 488 | } 489 | 490 | urlString += '?'; 491 | 492 | if (attrs.socialshareBody) { 493 | 494 | urlString += 'body=' + encodeURIComponent(attrs.socialshareBody); 495 | } 496 | 497 | if (attrs.socialshareSubject) { 498 | 499 | urlString += '&subject=' + encodeURIComponent(attrs.socialshareSubject); 500 | } 501 | if (attrs.socialshareCc) { 502 | 503 | urlString += '&cc=' + encodeURIComponent(attrs.socialshareCc); 504 | } 505 | if (attrs.socialshareBcc) { 506 | 507 | urlString += '&bcc=' + encodeURIComponent(attrs.socialshareBcc); 508 | } 509 | if ($window.self !== $window.top) { 510 | $window.open(urlString, '_blank'); 511 | } else { 512 | $window.open(urlString, '_self'); 513 | } 514 | 515 | } 516 | , facebookMessengerShare = function facebookMessengerShare($window, attrs, element) { 517 | 518 | var href = 'fb-messenger://share?link=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 519 | 520 | element.attr('href', href); 521 | element.attr('target', '_top'); 522 | } 523 | , manageTwitterShare = function manageTwitterShare($window, attrs) { 524 | var urlString = 'https://www.twitter.com/intent/tweet?'; 525 | 526 | if (attrs.socialshareText) { 527 | urlString += 'text=' + encodeURIComponent(attrs.socialshareText); 528 | } 529 | 530 | if (attrs.socialshareVia) { 531 | urlString += '&via=' + encodeURIComponent(attrs.socialshareVia); 532 | } 533 | 534 | if (attrs.socialshareHashtags) { 535 | urlString += '&hashtags=' + encodeURIComponent(attrs.socialshareHashtags); 536 | } 537 | 538 | //default to the current page if a URL isn't specified 539 | urlString += '&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 540 | 541 | $window.open( 542 | urlString, 543 | 'Twitter', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 544 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 545 | } 546 | , manageGooglePlusShare = function manageGooglePlusShare($window, attrs) { 547 | 548 | $window.open( 549 | 'https://plus.google.com/share?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) 550 | , 'Google+', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 551 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 552 | } 553 | , manageRedditShare = function manageRedditShare($window, attrs) { 554 | var urlString = 'https://www.reddit.com/'; 555 | 556 | if (attrs.socialshareSubreddit) { 557 | urlString += 'r/' + attrs.socialshareSubreddit + '/submit?url='; 558 | } else { 559 | urlString += 'submit?url='; 560 | } 561 | /*- 562 | * Reddit isn't responsive and at default width for our popups (500 x 500), everything is messed up. 563 | * So, overriding the width if it is less than 900 (played around to settle on this) and height if 564 | * it is less than 650px. 565 | */ 566 | if (attrs.socialsharePopupWidth < 900) { 567 | attrs.socialsharePopupWidth = 900; 568 | } 569 | 570 | if (attrs.socialsharePopupHeight < 650) { 571 | attrs.socialsharePopupHeight = 650; 572 | } 573 | 574 | $window.open( 575 | urlString + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&title=' + encodeURIComponent(attrs.socialshareText) 576 | , 'Reddit', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 577 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 578 | } 579 | , manageStumbleuponShare = function manageStumbleuponShare($window, attrs) { 580 | 581 | $window.open( 582 | 'https://www.stumbleupon.com/submit?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&title=' + encodeURIComponent(attrs.socialshareText) 583 | , 'StumbleUpon', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 584 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 585 | } 586 | , manageLinkedinShare = function manageLinkedinShare($window, attrs) { 587 | /* 588 | * Refer: https://developer.linkedin.com/docs/share-on-linkedin 589 | * Tab: Customized URL 590 | */ 591 | var urlString = 'https://www.linkedin.com/shareArticle?mini=true'; 592 | 593 | urlString += '&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 594 | 595 | if (attrs.socialshareText) { 596 | urlString += '&title=' + encodeURIComponent(attrs.socialshareText); 597 | } 598 | 599 | if (attrs.socialshareDescription) { 600 | urlString += '&summary=' + encodeURIComponent(attrs.socialshareDescription); 601 | } 602 | 603 | if (attrs.socialshareSource) { 604 | urlString += '&source=' + encodeURIComponent(attrs.socialshareSource); 605 | } 606 | 607 | $window.open( 608 | urlString, 609 | 'Linkedin', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 610 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 611 | } 612 | , managePinterestShare = function managePinterestShare($window, attrs) { 613 | 614 | $window.open( 615 | 'https://www.pinterest.com/pin/create/button/?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&media=' + encodeURIComponent(attrs.socialshareMedia) + '&description=' + encodeURIComponent(attrs.socialshareText) 616 | , 'Pinterest', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 617 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 618 | } 619 | , manageDiggShare = function manageDiggShare($window, attrs) { 620 | 621 | $window.open( 622 | 'https://www.digg.com/submit?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&title=' + encodeURIComponent(attrs.socialshareText) 623 | , 'Digg', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 624 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 625 | } 626 | , manageTumblrShare = function manageTumblrShare($window, attrs) { 627 | 628 | if (attrs.socialshareMedia) { 629 | var urlString = 'https://www.tumblr.com/share/photo?source=' + encodeURIComponent(attrs.socialshareMedia); 630 | 631 | if (attrs.socialshareText) { 632 | urlString += '&caption=' + encodeURIComponent(attrs.socialshareText); 633 | } 634 | 635 | $window.open( 636 | urlString, 637 | 'Tumblr', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 638 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 639 | } else { 640 | 641 | $window.open( 642 | 'https://www.tumblr.com/share/link?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&description=' + encodeURIComponent(attrs.socialshareText) 643 | , 'Tumblr', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 644 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 645 | } 646 | } 647 | , manageVkShare = function manageVkShare($window, attrs) { 648 | var urlString = 'https://www.vk.com/share.php?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 649 | 650 | if (attrs.socialshareText) { 651 | urlString += '&title=' + encodeURIComponent(attrs.socialshareText); 652 | } 653 | 654 | if (attrs.socialshareMedia) { 655 | urlString += '&image=' + encodeURIComponent(attrs.socialshareMedia); 656 | } 657 | 658 | if (attrs.socialshareDescription) { 659 | urlString += '&description=' + encodeURIComponent(attrs.socialshareDescription); 660 | } 661 | 662 | $window.open( 663 | urlString 664 | , 'Vk', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 665 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 666 | } 667 | , manageOkShare = function manageOkShare($window, attrs) { 668 | $window.open( 669 | 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1&st._surl=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&st.comments=' + encodeURIComponent(attrs.socialshareText) 670 | , 'Ok', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 671 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 672 | } 673 | , manageDeliciousShare = function manageDeliciousShare($window, attrs) { 674 | 675 | $window.open( 676 | 'https://www.delicious.com/save?v=5&noui&jump=close&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + '&title=' + encodeURIComponent(attrs.socialshareText) 677 | , 'Delicious', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 678 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 679 | } 680 | , manageBufferShare = function manageBufferShare($window, attrs) { 681 | var urlString = 'https://bufferapp.com/add?'; 682 | 683 | if (attrs.socialshareText) { 684 | urlString += 'text=' + encodeURIComponent(attrs.socialshareText); 685 | } 686 | 687 | if (attrs.socialshareVia) { 688 | urlString += '&via=' + encodeURIComponent(attrs.socialshareVia); 689 | } 690 | 691 | if (attrs.socialshareMedia) { 692 | urlString += '&picture=' + encodeURIComponent(attrs.socialshareMedia); 693 | } 694 | 695 | //default to the current page if a URL isn't specified 696 | urlString += '&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 697 | 698 | $window.open( 699 | urlString, 700 | 'Buffer', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 701 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 702 | } 703 | , manageHackernewsShare = function manageHackernewsShare($window, attrs) { 704 | var urlString = 'https://news.ycombinator.com/submitlink?'; 705 | 706 | if (attrs.socialshareText) { 707 | urlString += 't=' + encodeURIComponent(attrs.socialshareText) + '&'; 708 | } 709 | //default to the current page if a URL isn't specified 710 | urlString += 'u=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 711 | 712 | $window.open( 713 | urlString, 714 | 'Hackernews', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 715 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 716 | } 717 | , manageFlipboardShare = function manageFlipboardShare($window, attrs) { 718 | var urlString = 'https://share.flipboard.com/bookmarklet/popout?v=2&'; 719 | 720 | if (attrs.socialshareText) { 721 | urlString += 'title=' + encodeURIComponent(attrs.socialshareText) + '&'; 722 | } 723 | 724 | //default to the current page if a URL isn't specified 725 | urlString += 'url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 726 | 727 | $window.open( 728 | urlString, 729 | 'Flipboard', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 730 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 731 | } 732 | , managePocketShare = function managePocketShare($window, attrs) { 733 | var urlString = 'https://getpocket.com/save?'; 734 | 735 | if (attrs.socialshareText) { 736 | urlString += 'text=' + encodeURIComponent(attrs.socialshareText) + '&'; 737 | } 738 | 739 | //default to the current page if a URL isn't specified 740 | urlString += 'url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 741 | 742 | $window.open( 743 | urlString, 744 | 'Pocket', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 745 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 746 | } 747 | , manageWordpressShare = function manageWordpressShare($window, attrs) { 748 | var urlString = 'http://wordpress.com/press-this.php?'; 749 | 750 | if (attrs.socialshareText) { 751 | urlString += 't=' + encodeURIComponent(attrs.socialshareText) + '&'; 752 | } 753 | if (attrs.socialshareMedia) { 754 | urlString += 'i=' + encodeURIComponent(attrs.socialshareMedia) + '&'; 755 | } 756 | 757 | //default to the current page if a URL isn't specified 758 | urlString += 'u=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 759 | 760 | $window.open( 761 | urlString, 762 | 'Wordpress', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 763 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 764 | } 765 | , manageXingShare = function manageXingShare($window, attrs) { 766 | var followUrl = ''; 767 | 768 | if (attrs.socialshareFollow) { 769 | followUrl = '&follow_url=' + encodeURIComponent(attrs.socialshareFollow); 770 | } 771 | $window.open( 772 | 'https://www.xing.com/spi/shares/new?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href) + followUrl 773 | , 'Xing', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 774 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 775 | } 776 | , manageEvernoteShare = function manageEvernoteShare($window, attrs) { 777 | 778 | var urlString = 'http://www.evernote.com/clip.action?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 779 | 780 | if (attrs.socialshareText) { 781 | urlString += '&title=' + encodeURIComponent(attrs.socialshareText); 782 | } 783 | 784 | $window.open( 785 | urlString 786 | , 'Evernote', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 787 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 788 | } 789 | , manageWhatsappShare = function manageWhatsappShare($window, attrs, element) { 790 | 791 | var href = 'whatsapp://send?text=' + encodeURIComponent(attrs.socialshareText) + '%0A' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 792 | 793 | element.attr('href', href); 794 | element.attr('target', '_top'); 795 | 796 | } 797 | , manageSmsShare = function smsShare($window, attrs, element) { 798 | 799 | if (attrs.socialshareText.indexOf('%') >= 0) { 800 | $log.warn('sending sms text with "%" sign is not supported'); 801 | } 802 | 803 | var body = encodeURIComponent(attrs.socialshareText.replace('%','')) 804 | , toPhoneNumber = attrs.socialshareTo || '' 805 | , urlString; 806 | 807 | if (attrs.socialshareUrl) { 808 | body += encodeURIComponent(attrs.socialshareUrl); 809 | } 810 | 811 | urlString = 'sms:' + toPhoneNumber + '?&body=' + body; 812 | 813 | element.attr('href', urlString); 814 | element.attr('target', '_blank'); 815 | } 816 | , manageViberShare = function manageViberShare($window, attrs, element) { 817 | 818 | var href = 'viber://forward?text=' + encodeURIComponent(attrs.socialshareText) + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 819 | 820 | element.attr('href', href); 821 | element.attr('target', '_top'); 822 | } 823 | , manageTelegramShare = function manageTelegramShare($window, attrs) { 824 | 825 | var urlString = 'https://telegram.me/share/url?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 826 | 827 | if (attrs.socialshareText) { 828 | urlString += '&text=' + encodeURIComponent(attrs.socialshareText); 829 | } 830 | 831 | $window.open( 832 | urlString 833 | , 'Telegram', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 834 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 835 | } 836 | , skypeShare = function skypeShare($window, attrs) { 837 | var urlString = 'https://web.skype.com/share?source=button&url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 838 | 839 | if (attrs.socialshareText) { 840 | urlString += '&text=' + encodeURIComponent(attrs.socialshareText); 841 | } 842 | 843 | $window.open( 844 | urlString 845 | , 'Skype', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 846 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 847 | } 848 | , weiboShare = function weiboShare($window, attrs) { 849 | var urlString = 'http://service.weibo.com/share/share.php?url=' + encodeURIComponent(attrs.socialshareUrl || $window.location.href); 850 | 851 | if (attrs.socialshareText) { 852 | urlString += '&title=' + encodeURIComponent(attrs.socialshareText); 853 | } 854 | 855 | $window.open( 856 | urlString 857 | , 'Weibo', 'toolbar=0,status=0,resizable=yes,width=' + attrs.socialsharePopupWidth + ',height=' + attrs.socialsharePopupHeight 858 | + ',top=' + ($window.innerHeight - attrs.socialsharePopupHeight) / 2 + ',left=' + ($window.innerWidth - attrs.socialsharePopupWidth) / 2); 859 | } 860 | , socialshareService = /*@ngInject*/ ['$window', '$log', function socialshareService($window, $log) { 861 | 862 | this.emailShare = manageEmailShare; 863 | this.facebookShare = manageFacebookShare; 864 | this.twitterShare = manageTwitterShare; 865 | //**** Fb Messenger can't open without an element clicked (href) 866 | //this.facebookMessengerShare = facebookMessengerShare; 867 | this.stumbleuponShare = manageStumbleuponShare; 868 | this.pinterestShare = managePinterestShare; 869 | this.googleShare = manageGooglePlusShare; 870 | this.bufferShare = manageBufferShare; 871 | this.hackernewsShare = manageHackernewsShare; 872 | this.okShare = manageOkShare; 873 | this.deliciousShare = manageDeliciousShare; 874 | this.pocketShare = managePocketShare; 875 | this.vkShare = manageVkShare; 876 | this.flipboardShare = manageFlipboardShare; 877 | this.xingShare = manageXingShare; 878 | this.diggShare = manageDiggShare; 879 | this.linkedinShare = manageLinkedinShare; 880 | this.wordpressShare = manageWordpressShare; 881 | this.telegramShare = manageTelegramShare; 882 | this.redditShare = manageRedditShare; 883 | this.evernoteShare = manageEvernoteShare; 884 | this.tumblrShare = manageTumblrShare; 885 | //**** viber can't share without an element clicked (href) 886 | //this.viberShare = manageViberShare; 887 | //**** whatsapp can't share without an element clicked (href) 888 | //this.whatsappShare = manageWhatsappShare; 889 | this.skypeShare = skypeShare; 890 | this.smsShare = manageSmsShare; 891 | this.weiboShare = weiboShare; 892 | 893 | this.share = function shareTrigger(serviceShareConf) { 894 | 895 | switch (serviceShareConf.provider) { 896 | case 'email': { 897 | this.emailShare($window, serviceShareConf.attrs); 898 | break; 899 | } 900 | case 'sms': { 901 | this.smsShare($window, $log, serviceShareConf.attrs); 902 | break; 903 | } 904 | case 'facebook': { 905 | this.facebookShare($window, serviceShareConf.attrs); 906 | break; 907 | } 908 | case 'twitter': { 909 | this.twitterShare($window, serviceShareConf.attrs); 910 | break; 911 | } 912 | case 'pinterest': { 913 | this.pinterestShare($window, serviceShareConf.attrs); 914 | break; 915 | } 916 | case 'ok': { 917 | this.okShare($window, serviceShareConf.attrs); 918 | break; 919 | } 920 | case 'vk': { 921 | this.vkShare($window, serviceShareConf.attrs); 922 | break; 923 | } 924 | case 'delicious': { 925 | this.deliciousShare($window, serviceShareConf.attrs); 926 | break; 927 | } 928 | case 'digg': { 929 | this.diggShare($window, serviceShareConf.attrs); 930 | break; 931 | } 932 | case 'google': { 933 | this.googleShare($window, serviceShareConf.attrs); 934 | break; 935 | } 936 | case 'reddit': { 937 | this.redditShare($window, serviceShareConf.attrs); 938 | break; 939 | } 940 | case 'hackernews': { 941 | this.hackernewsShare($window, serviceShareConf.attrs); 942 | break; 943 | } 944 | case 'skype': { 945 | this.skypeShare($window, serviceShareConf.attrs); 946 | break; 947 | } 948 | case 'evernote': { 949 | this.evernoteShare($window, serviceShareConf.attrs); 950 | break; 951 | } 952 | case 'pocket': { 953 | this.pocketShare($window, serviceShareConf.attrs); 954 | break; 955 | } 956 | case 'tumblr': { 957 | this.tumblrShare($window, serviceShareConf.attrs); 958 | break; 959 | } 960 | case 'telegram': { 961 | this.telegramShare($window, serviceShareConf.attrs); 962 | break; 963 | } 964 | case 'xing': { 965 | this.xingShare($window, serviceShareConf.attrs); 966 | break; 967 | } 968 | case 'buffer': { 969 | this.bufferShare($window, serviceShareConf.attrs); 970 | break; 971 | } 972 | case 'stumbleupon': { 973 | this.stumbleuponShare($window, serviceShareConf.attrs); 974 | break; 975 | } 976 | case 'linkedin': { 977 | this.linkedinShare($window, serviceShareConf.attrs); 978 | break; 979 | } 980 | case 'wordpress': { 981 | this.wordpressShare($window, serviceShareConf.attrs); 982 | break; 983 | } 984 | case 'flipboard': { 985 | this.flipboardShare($window, serviceShareConf.attrs); 986 | break; 987 | } 988 | case 'weibo': { 989 | this.weiboShare($window, serviceShareConf.attrs); 990 | break; 991 | } 992 | default: { 993 | return; 994 | } 995 | } 996 | }; 997 | }] 998 | , socialshareDirective = /*@ngInject*/ ['$window', 'socialshareConf', 'Socialshare', '$log', function socialshareDirective($window, socialshareConf, $log) { 999 | 1000 | var linkingFunction = function linkingFunction($scope, element, attrs) { 1001 | 1002 | // observe the values in each of the properties so that if they're updated elsewhere, 1003 | // they are updated in this directive. 1004 | var configurationElement 1005 | , index = 0 1006 | , onEventTriggered = function onEventTriggered() { 1007 | /*eslint-disable no-use-before-define*/ 1008 | if (attrs.socialshareProvider in sharingFunctions) { 1009 | sharingFunctions[attrs.socialshareProvider]($window, attrs, element); 1010 | } else { 1011 | return true; 1012 | } 1013 | }; 1014 | /*eslint-enable no-use-before-define*/ 1015 | //looking into configuration if there is a config for the current provider 1016 | for (; index < socialshareConf.length; index += 1) { 1017 | if (socialshareConf[index].provider === attrs.socialshareProvider) { 1018 | configurationElement = socialshareConf[index]; 1019 | break; 1020 | } 1021 | } 1022 | 1023 | if (socialshareProviderNames.indexOf(configurationElement.provider) === -1) { 1024 | $log.warn('Invalid Provider Name : ' + attrs.socialshareProvider); 1025 | } 1026 | 1027 | //if some attribute is not define provide a default one 1028 | attrs.socialshareMobileiframe = attrs.socialshareMobileiframe || configurationElement.conf.mobile_iframe; 1029 | attrs.socialshareQuote = attrs.socialshareQuote || configurationElement.conf.quote; 1030 | attrs.socialshareTitle = attrs.socialshareTitle || configurationElement.conf.title; 1031 | attrs.socialshareUrl = attrs.socialshareUrl || configurationElement.conf.url || configurationElement.conf.href; 1032 | attrs.socialshareText = attrs.socialshareText || configurationElement.conf.text; 1033 | attrs.socialshareMedia = attrs.socialshareMedia || configurationElement.conf.media; 1034 | attrs.socialshareType = attrs.socialshareType || configurationElement.conf.type; 1035 | attrs.socialshareVia = attrs.socialshareVia || configurationElement.conf.via; 1036 | attrs.socialshareTo = attrs.socialshareTo || configurationElement.conf.to; 1037 | attrs.socialshareFrom = attrs.socialshareFrom || configurationElement.conf.from; 1038 | attrs.socialshareRef = attrs.socialshareRef || configurationElement.conf.ref; 1039 | attrs.socialshareDislay = attrs.socialshareDislay || configurationElement.conf.display; 1040 | attrs.socialshareSource = attrs.socialshareSource || configurationElement.conf.source; 1041 | attrs.socialshareCaption = attrs.socialshareCaption || configurationElement.conf.caption; 1042 | attrs.socialshareRedirectUri = attrs.socialshareRedirectUri || configurationElement.conf.redirectUri; 1043 | attrs.socialshareTrigger = attrs.socialshareTrigger || configurationElement.conf.trigger; 1044 | attrs.socialsharePopupHeight = attrs.socialsharePopupHeight || configurationElement.conf.popupHeight; 1045 | attrs.socialsharePopupWidth = attrs.socialsharePopupWidth || configurationElement.conf.popupWidth; 1046 | attrs.socialshareSubreddit = attrs.socialshareSubreddit || configurationElement.conf.subreddit; 1047 | attrs.socialshareDescription = attrs.socialshareDescription || configurationElement.conf.description; 1048 | attrs.socialshareFollow = attrs.socialshareFollow || configurationElement.conf.follow; 1049 | attrs.socialshareHashtags = attrs.socialshareHashtags || configurationElement.conf.hashtags; 1050 | attrs.socialshareBody = attrs.socialshareBody || configurationElement.conf.body; 1051 | attrs.socialshareSubject = attrs.socialshareSubject || configurationElement.conf.subject; 1052 | attrs.socialshareCc = attrs.socialshareCc || configurationElement.conf.cc; 1053 | attrs.socialshareBcc = attrs.socialshareBcc || configurationElement.conf.bcc; 1054 | 1055 | if (attrs.socialshareTrigger) { 1056 | 1057 | element.bind(attrs.socialshareTrigger, onEventTriggered); 1058 | } else { 1059 | 1060 | onEventTriggered(); 1061 | } 1062 | }; 1063 | 1064 | return { 1065 | 'restrict': 'A', 1066 | 'link': linkingFunction 1067 | }; 1068 | }] 1069 | , sharingFunctions = { 1070 | 'email': manageEmailShare 1071 | , 'facebook': manageFacebookShare 1072 | , 'facebook-messenger': facebookMessengerShare 1073 | , 'twitter': manageTwitterShare 1074 | , 'google': manageGooglePlusShare 1075 | , 'reddit': manageRedditShare 1076 | , 'stumbleupon': manageStumbleuponShare 1077 | , 'linkedin': manageLinkedinShare 1078 | , 'pinterest': managePinterestShare 1079 | , 'digg': manageDiggShare 1080 | , 'tumblr': manageTumblrShare 1081 | , 'vk': manageVkShare 1082 | , 'ok': manageOkShare 1083 | , 'delicious': manageDeliciousShare 1084 | , 'buffer': manageBufferShare 1085 | , 'hackernews': manageHackernewsShare 1086 | , 'flipboard': manageFlipboardShare 1087 | , 'pocket': managePocketShare 1088 | , 'wordpress': manageWordpressShare 1089 | , 'xing': manageXingShare 1090 | , 'evernote': manageEvernoteShare 1091 | , 'whatsapp': manageWhatsappShare 1092 | , 'sms': manageSmsShare 1093 | , 'telegram': manageTelegramShare 1094 | , 'viber': manageViberShare 1095 | , 'skype': skypeShare 1096 | , 'weibo': weiboShare 1097 | }; 1098 | 1099 | 1100 | angular.module('720kb.socialshare', []) 1101 | .provider(directiveName + 'Conf', socialshareConfigurationProvider) 1102 | .service(serviceName, socialshareService) 1103 | .directive(directiveName, socialshareDirective); 1104 | }(angular)); 1105 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-socialshare", 3 | "version": "2.3.11", 4 | "description": "A social media url and content share module for angularjs.", 5 | "homepage": "http://720kb.github.io/angular-socialshare", 6 | "keywords": [ 7 | "social", 8 | "sharing", 9 | "buttons", 10 | "share", 11 | "angular", 12 | "angularjs" 13 | ], 14 | "scripts": { 15 | "precommit": "gulp lint", 16 | "preversion": "gulp lint", 17 | "lint": "gulp lint", 18 | "minify": "gulp minify", 19 | "version": "gulp minify && ./tasks/bower-version-bump && git add -A .", 20 | "postversion": "git push && git push --tags" 21 | }, 22 | "files": [ 23 | "dist", 24 | "index.js" 25 | ], 26 | "main": "index.js", 27 | "repository": { 28 | "type": "git", 29 | "url": "https://github.com/720kb/angular-socialshare.git" 30 | }, 31 | "license": "MIT", 32 | "devDependencies": { 33 | "browser-sync": "^2.9.11", 34 | "connect-history-api-fallback": "^1.1.0", 35 | "del": "^2.0.2", 36 | "gulp": "^3.9.0", 37 | "gulp-changed": "^1.3.0", 38 | "gulp-eslint": "^1.0.0", 39 | "gulp-header": "^1.7.1", 40 | "gulp-jscs": "^3.0.2", 41 | "gulp-jshint": "^1.12.0", 42 | "gulp-ng-annotate": "^1.1.0", 43 | "gulp-plumber": "^1.0.1", 44 | "gulp-rename": "^1.2.2", 45 | "gulp-sourcemaps": "^1.6.0", 46 | "gulp-uglify": "^1.4.2", 47 | "husky": "^0.10.2", 48 | "jshint-stylish": "^2.0.1", 49 | "require-dir": "^0.3.0", 50 | "run-sequence": "^1.1.4", 51 | "vinyl-paths": "^2.0.0" 52 | }, 53 | "author": { 54 | "name": "Filippo Oretti", 55 | "email": "filippo.oretti@gmail.com", 56 | "url": "https://github.com/45kb" 57 | }, 58 | "contributors": [ 59 | { 60 | "name": "Dario Andrei", 61 | "email": "wouldgo84@gmail.com", 62 | "url": "https://github.com/wouldgo" 63 | }, 64 | { 65 | "name": "Luca Bressanelli", 66 | "email": "luca.bressanelli@gmail.com", 67 | "url": "https://github.com/ryppy" 68 | } 69 | ] 70 | } 71 | --------------------------------------------------------------------------------