estevanmaito / sharect Goto Github PK
View Code? Open in Web Editor NEW๐ A lightweight JavaScript library to let users share their text selections to social networks.
Home Page: https://estevanmaito.github.io/sharect/
License: MIT License
๐ A lightweight JavaScript library to let users share their text selections to social networks.
Home Page: https://estevanmaito.github.io/sharect/
License: MIT License
During tests I realized that Sharect would not work well with the default way mobile OS's treat text selection on browsers, as it already shows various options, including share the selection.
The positioning won't follow the selection on scroll if that's inside other relative or absolute positioned elements.
Select and scroll in the middle paragraphs:
https://bl.ocks.org/Laurian/627557520f103794d5aecf503607a09c
Note: I forked this repo and I might have a fix soon.
Describe the solution you'd like
Would like to be able to share via email with the subject line auto-populated with link to page and message auto-populated with selected text.
if "&" comes between selected text facebook post remove text after "&".It does not able to parse "&" . If it parse "&" to %26 then this bug will be fixed
Is your feature request related to a problem? Please describe.
No.
Describe the solution you'd like
Sharect doesn't work on mobile now because on those systems when you select text, the OS already creates a tooltip. It's possible to still give the user the options to share, but it must be done in another, maybe without a tooltip.
Describe alternatives you've considered
The image below shows a common approach that websites give users to share the entire article.
The idea is really the same.
This plugin do not work for a given particular id or class or html element. or am I missing something.
Say I wan to enable this plugin only on div having id say id1 but not on id having value id2 etc. same is true for class as well.
Would you suggest, how to achieve that.
Is your feature request related to a problem? Please describe.
It's not related to a problem... yet.
Describe the solution you'd like
Tests will accelerate the development of new features and bring confidence to contributors and users.
Describe alternatives you've considered
There's no alternatives to consider. We test, or we test.
Is your feature request related to a problem? Please describe.
It is overkill to create an app just to get and ID to just create a share button. Then you need to add the following code to your page, that will download another script.
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR-APP-ID',
xfbml : true,
version : 'v3.2'
});
FB.AppEvents.logPageView();
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Describe the solution you'd like
Open a pop-up with the following URL, just like we already do with Twitter share.
https://www.facebook.com/sharer/sharer.php?
u=[current-url]
"e=[selected-text]
Hi Estevan
I have long wanted to make a simple wp plugin and place it in the worldpress directory.
https://github.com/nektobit/wp-sharect
How do you like this idea? Naturally, I can support users who have problems with the wordpress side.
If you think that you should not use your library this way, I will delete the repository without question :)
Is there a way to add callback functions to share buttons?
I tried with version 10.1.1 on macOS Sierra (10.12.5)
Is your feature request related to a problem? Please describe.
Well, problem is a hard word ๐
Today, if someone would like to create another button, let's say, for sharing on Reddit, they would need to change the source code to, at least:
redditConfig
property to hold the SVG icon
and the url
createRedditButton
_icons
propertyThis way, the Reddit button would appear in the tooltip.
Describe the solution you'd like
First of all, the current way used to create buttons isn't very DRY. This could be improved.
A new method could be added to the current chain (config
and init
), like createShareButton
or createCustomShareButton
(just ideas), that would accept an SVG icon and a function responsible for the click event.
These options would be appended to the default _icons
property and then rendered from init
.
Describe alternatives you've considered
I didn't considered alternatives and would like to hear opinions on this. I don't think we should add more options to the core, as I don't think the mean user would use them. With the proposed approach, developers whose projects request more social share buttons could add whatever other functionalities they want.
is it mobile responsive?
Highlighting a snippet of text containing a percentage doesn't work with Twitter text share - would it be possible to accommodate for special characters? This would be particularly useful for content containing lots of stats.
Just wanted to let you know that your code & demo doesn't work on IE11, because of the way you apply CSS on the created element. See https://devtidbits.com/2016/06/12/assignment-to-read-only-properties-is-not-allowed-in-strict-mode/ for an example / explanation.
Describe the bug
Doesn't work with text highlighted using touch.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.