Skip to content

Commit

Permalink
update var css
Browse files Browse the repository at this point in the history
  • Loading branch information
Ede1994 committed May 16, 2024
1 parent 224a6f1 commit cdc31c6
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions _includes/create-button-with-link.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<script>
function createButtonWithLink() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var backgroundColor = options.backgroundColor === undefined ? "#000" : options.backgroundColor;
var cornerOffset = options.cornerOffset === undefined ? 20 : options.cornerOffset;
var diameter = options.diameter === undefined ? 56 : options.diameter;
var id = options.id === undefined ? "button-with-link" : options.id;
var innerHTML = options.innerHTML === undefined ? 'Test button!' : options.innerHTML;
var link = options.link === undefined ? './pages/404.html' : options.link;
var size = options.size === undefined ? diameter : options.size;
var textColor = options.textColor === undefined ? "#fff" : options.textColor;
var zIndex = options.zIndex === undefined ? 1 : options.zIndex;
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var backgroundColor = options.backgroundColor === undefined ? "#000" : options.backgroundColor;
var cornerOffset = options.cornerOffset === undefined ? 20 : options.cornerOffset;
var diameter = options.diameter === undefined ? 56 : options.diameter;
var id = options.id === undefined ? "button-with-link" : options.id;
var innerHTML = options.innerHTML === undefined ? 'Test button!' : options.innerHTML;
var link = options.link === undefined ? './pages/404.html' : options.link;
var size = options.size === undefined ? diameter : options.size;
var textColor = options.textColor === undefined ? "#fff" : options.textColor;
var zIndex = options.zIndex === undefined ? 1 : options.zIndex;
var css = options.css === undefined ?
"#" + id + "{background:" + backgroundColor + ";-webkit-border-radius:10%;-moz-border-radius:10%;border-radius:10%;bottom:" + (cornerOffset + 100) + "px;-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26);color:" + textColor + ";cursor:pointer;display:block;height:auto;width:200px;padding:10px;opacity:1;outline:0;position:fixed;right:" + cornerOffset + "px;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-transition:bottom .2s,opacity .2s;-o-transition:bottom .2s,opacity .2s;-moz-transition:bottom .2s,opacity .2s;transition:bottom .2s,opacity .2s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:" + zIndex + "}"
: options.css;

var css = "#" + id + "{background:" + backgroundColor + ";-webkit-border-radius:10%;-moz-border-radius:10%;border-radius:10%;bottom:" + (cornerOffset + 100) + "px;-webkit-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);-moz-box-shadow:0 2px 5px 0 rgba(0,0,0,.26);box-shadow:0 2px 5px 0 rgba(0,0,0,.26);color:" + textColor + ";cursor:pointer;display:block;height:auto;width:200px;padding:10px;opacity:1;outline:0;position:fixed;right:" + cornerOffset + "px;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-transition:bottom .2s,opacity .2s;-o-transition:bottom .2s,opacity .2s;-moz-transition:bottom .2s,opacity .2s;transition:bottom .2s,opacity .2s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:" + zIndex + "}";
var style = document.createElement("style");
style.appendChild(document.createTextNode(css));
document.head.insertAdjacentElement("afterbegin", style);
var style = document.createElement("style");
style.appendChild(document.createTextNode(css));
document.head.insertAdjacentElement("afterbegin", style);

var button = document.createElement("a");
button.id = id;
button.innerHTML = innerHTML;
button.href = link;
button.target = "_blank";
document.body.appendChild(button);
var button = document.createElement("a");
button.id = id;
button.innerHTML = innerHTML;
button.href = link;
button.target = "_blank";
document.body.appendChild(button);
}
</script>

0 comments on commit cdc31c6

Please sign in to comment.