Skip to content

Commit

Permalink
Merge pull request #6 from estevanmaito/dev
Browse files Browse the repository at this point in the history
Code refactor, IE11 fix, 1.0.2
  • Loading branch information
estevanmaito authored Dec 6, 2018
2 parents 85f04f4 + 3612ada commit f75321b
Show file tree
Hide file tree
Showing 6 changed files with 4,381 additions and 41 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ A **lightweight** (3.5kb) JavaScript library to let users share their text selec
|---------|---------|-------------|
|sharect|<a href="https://www.npmjs.com/package/sharect"><img src="https://img.shields.io/npm/v/sharect.svg?style=flat-square"></a>|No dependencies, plug-n-play|
|sharect-react|Soon|React.js plugin|
|sharect-vue|Soon|Vue.js plugin|
|sharect-chrome|Soon|Chrome extension|

## Usage

Expand Down
32 changes: 16 additions & 16 deletions dist/sharect.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ var Sharect = function () {
}

function appendIcons() {
var div = document.createElement('div');
var count = 0;
var icons = document.createElement('div');
var length = 0;
if (_networks.twitter) {
div.appendChild(twitterButton());
count++;
icons.appendChild(twitterButton());
length++;
}
if (_networks.facebook) {
div.appendChild(facebookButton());
count++;
icons.appendChild(facebookButton());
length++;
}
return {
icons: div,
length: count
icons: icons,
length: length
};
}

Expand All @@ -92,18 +92,18 @@ var Sharect = function () {
_icons = appendIcons();
setTooltipPosition();

var div = document.createElement('div');
div.className = 'sharect';
div.style = 'line-height:0;' + 'position:absolute;' + 'background-color:' + _backgroundColor + ';' + 'border-radius:3px;' + 'top:' + _top + 'px;' + 'left:' + _left + 'px;' + 'transition:all .2s ease-in-out;';
var container = document.createElement('div');
container.className = 'sharect';
container.style.cssText = 'line-height:0;' + 'position:absolute;' + 'background-color:' + _backgroundColor + ';' + 'border-radius:3px;' + 'top:' + _top + 'px;' + 'left:' + _left + 'px;' + 'transition:all .2s ease-in-out;';

div.appendChild(_icons.icons);
container.appendChild(_icons.icons);

var arrow = document.createElement('div');
arrow.style = 'position:absolute;' + 'border-left:' + _arrowSize + 'px solid transparent;' + 'border-right:' + _arrowSize + 'px solid transparent;' + 'border-top:' + _arrowSize + 'px solid ' + _backgroundColor + ';' + 'bottom:-' + (_arrowSize - 1) + 'px;' + 'left:' + (_iconSize * _icons.length / 2 - _arrowSize) + 'px;' + 'width:0;' + 'height:0;';
arrow.style.cssText = 'position:absolute;' + 'border-left:' + _arrowSize + 'px solid transparent;' + 'border-right:' + _arrowSize + 'px solid transparent;' + 'border-top:' + _arrowSize + 'px solid ' + _backgroundColor + ';' + 'bottom:-' + (_arrowSize - 1) + 'px;' + 'left:' + (_iconSize * _icons.length / 2 - _arrowSize) + 'px;' + 'width:0;' + 'height:0;';

div.appendChild(arrow);
container.appendChild(arrow);

document.body.appendChild(div);
document.body.appendChild(container);
}

function attachEvents() {
Expand Down Expand Up @@ -159,7 +159,7 @@ var Sharect = function () {

function Button(icon, clickFn) {
var btn = document.createElement('div');
btn.style = 'display:inline-block;' + 'margin:7px;' + 'cursor:pointer;' + 'transition:all .2s ease-in-out;';
btn.style.cssText = 'display:inline-block;' + 'margin:7px;' + 'cursor:pointer;' + 'transition:all .2s ease-in-out;';
btn.innerHTML = icon;
btn.onclick = clickFn;
btn.onmouseover = function () {
Expand Down
2 changes: 1 addition & 1 deletion dist/sharect.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f75321b

Please sign in to comment.