├── .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 |  5 | 6 | [](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