Skip to content

Commit

Permalink
fix IE11 problem #5
Browse files Browse the repository at this point in the history
  • Loading branch information
estevanmaito committed Dec 6, 2018
1 parent f833a7e commit 3612ada
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sharect",
"version": "1.0.1",
"version": "1.0.2",
"description": "Share selection text",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions src/sharect.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const Sharect = (function(){

const container = document.createElement('div')
container.className = 'sharect'
container.style = 'line-height:0;'
container.style.cssText = 'line-height:0;'
+ 'position:absolute;'
+ 'background-color:' + _backgroundColor + ';'
+ 'border-radius:3px;'
Expand All @@ -107,7 +107,7 @@ const Sharect = (function(){
container.appendChild(_icons.icons)

const arrow = document.createElement('div')
arrow.style = 'position:absolute;'
arrow.style.cssText = 'position:absolute;'
+ 'border-left:' + _arrowSize + 'px solid transparent;'
+ 'border-right:' + _arrowSize + 'px solid transparent;'
+ 'border-top:' + _arrowSize + 'px solid ' + _backgroundColor + ';'
Expand All @@ -117,15 +117,15 @@ const Sharect = (function(){
+ 'height:0;'

container.appendChild(arrow)

document.body.appendChild(container)
}

function attachEvents() {
function hasSelection() {
return !!window.getSelection().toString()
}

function hasTooltipDrawn() {
return !!document.querySelector('.sharect')
}
Expand Down Expand Up @@ -180,7 +180,7 @@ const Sharect = (function(){

function Button(icon, clickFn) {
const btn = document.createElement('div')
btn.style = 'display:inline-block;'
btn.style.cssText = 'display:inline-block;'
+ 'margin:7px;'
+ 'cursor:pointer;'
+ 'transition:all .2s ease-in-out;'
Expand Down

0 comments on commit 3612ada

Please sign in to comment.