forked from daattali/beautiful-jekyll
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |