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"> | |
<title>Mechanical Grass · CodePen</title> | |
<!-- | |
Copyright (c) 2012 Tim Holman, http://codepen.io/tholman | |
Permission is hereby granted, free of charge, to any person obtaining |
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
<script type="text/javascript"> | |
function setTime() { | |
var timeOut = false; | |
var currentDate = new Date(); | |
var seconds = currentDate.getSeconds(); | |
var minutes = currentDate.getMinutes() * 60; | |
var hours = currentDate.getHours() * 3600; | |
var myriaseconds = seconds + minutes + hours; | |
var mt = myriaseconds/10000; | |
document.body.innerHTML = mt.toPrecision(5); |
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
<div contenteditable>http://google.com</div> | |
<script> | |
document.onkeydown = function(evt) { | |
evt = evt || window.event; | |
if (evt.keyCode == 13) { // enter key | |
var text = document.querySelector('div').innerHTML; | |
var url = text.match(/(HTTP:\/\/)([a-zA-Z0-9.\/&?_=!*,\(\)+-]+)/i); | |
var foourl = url[0].replace("http", "foo"); | |
document.foo = "foo"; | |
document.http = "http"; |