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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
/* Document */ | |
html { | |
box-sizing: border-box; | |
font-family: sans-serif; | |
-webkit-text-size-adjust: 100%; | |
-ms-text-size-adjust: 100%; | |
-webkit-tap-highlight-color: transparent; | |
} | |
*, |
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
function countByte (str) { | |
return decodeURI( | |
encodeURI(str) | |
).length //URL-encode use UTF-8 | |
} //Note: this fails for input that contains lone surrogates. | |
} | |
Use http://mths.be/utf8js if you need something more robust. | |
function countByte (str) { |
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
var pfx = ["webkit", "moz", "MS", "o", ""], | |
function PrefixedEvent(element, type, callback) { | |
element.removeEventListener(pfx[p] + type, callback, false); | |
for (var p = 0; p < pfx.length; p++) { | |
if (!pfx[p]) type = type.toLowerCase(); | |
element.addEventListener(pfx[p] + type, callback, false); | |
} | |
} |