This file contains hidden or 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
data:text/html, <html><head><link href='http://fonts.googleapis.com/css?family=Lato:300,400,700 rel='stylesheet' type='text/css'><style type="text/css"> html { font-family: "Lato"; font-weight: 300; color:#e9e9e9; background-color:#222; } * { -webkit-transition: all linear 1s; }</style></head><body contenteditable style="font-size:1.6em;line-height:1.4;max-width:80rem;margin:0 auto;padding:3rem;"> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Add to Bookmarks Cross-Browser Demo</title> | |
<!-- from https://www.thewebflash.com/how-to-add-a-cross-browser-add-to-favorites-bookmark-button-to-your-website/ --> | |
<style> | |
#bookmark-this { | |
padding: 5px 10px; | |
font-size: 12px; |
This file contains hidden or 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
function selectText(element) { | |
if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { | |
element.select(); | |
return; | |
} | |
var rangeObj, selection; | |
if (document.createRange) { // IE >=9 and all other browsers | |
rangeObj = document.createRange(); | |
rangeObj.selectNodeContents(element); |
This file contains hidden or 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
var isTouchDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0); |
This file contains hidden or 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
var cb = function() { | |
var l = document.createElement('link'); l.rel = 'stylesheet'; | |
l.href = '//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css'; | |
var h = document.getElementsByTagName('head')[0]; h.insertBefore(l, h.lastChild); | |
}; | |
var raf = requestAnimationFrame || mozRequestAnimationFrame || | |
webkitRequestAnimationFrame || msRequestAnimationFrame; | |
if (raf) raf(cb); | |
else if (window.addEventListener) window.addEventListener('load', cb); | |
else if (window.attachEvent) window.attachEvent("onload", cb); |
This file contains hidden or 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
function clearSelection() { | |
if (window.getSelection) { | |
var selection = window.getSelection(); | |
if (selection.removeAllRanges) { | |
selection.removeAllRanges(); | |
} else if (selection.empty) { | |
selection.empty(); | |
} | |
} else if (document.selection) { | |
document.selection.empty(); |
This file contains hidden or 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
function getURLParameter(sParam) | |
{ | |
var sPageURL = window.location.search.substring(1); | |
var sURLVariables = sPageURL.split('&'); | |
for (var i = 0, len = sURLVariables.length; i < len; i++) | |
{ | |
var sParameterName = sURLVariables[i].split('='); | |
if (sParameterName[0] == sParam) | |
{ | |
return sParameterName[1]; |
This file contains hidden or 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
// Get click event handler set by JavaScript | |
document.getElementById("ele").onclick; | |
// Get event handlers set by jQuery | |
$("#ele").data("events"); // < jQuery 1.8 | |
$._data("#ele", "events"); // jQuery 1.8+ | |
// from http://codesr.thewebflash.com/2014/07/javascript-get-event-handlers-of-element.html |
This file contains hidden or 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
// Get click event handler set by JavaScript | |
document.getElementById("ele").onclick; | |
// Get event handlers set by jQuery | |
$("#ele").data("events"); // < jQuery 1.8 | |
$._data("#ele", "events"); // jQuery 1.8+ |
OlderNewer