~mwshinn/+junk/timezones

« back to all changes in this revision

Viewing changes to index.php

  • Committer: Max Shinn
  • Date: 2016-09-30 00:13:16 UTC
  • Revision ID: max@maxshinnpotential.com-20160930001316-43l0ofd0g9wc9qyd
URL shortener

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
<head>
105
105
<title>Time</title>
106
106
<link rel="stylesheet" href="style.css" type="text/css">
 
107
<script type="text/javascript" charset="utf-8" src="http://bit.ly/javascript-api.js?version=latest&login=timezonems&apiKey=R_d2a26c47376848c98053619d2ef6d4a3"></script>
 
108
<!--Adapted from http://monicams.com/blog/bit-ly-javascript-button/ -->
 
109
<script>
 
110
shortenURL = function() {
 
111
    BitlyClient.shorten(window.location, 'shortenURLcallback');
 
112
}
 
113
shortenURLcallback = function(data) {
 
114
    for (first in data.results) break; // Get first (and only) element in the response object
 
115
    document.getElementById("short").innerHTML = data.results[first]['shortUrl'];
 
116
}
 
117
</script>
107
118
</head>
108
119
<body>
 
120
<button onclick="shortenURL()">Shorten URL</button> <span id="short"></span>
109
121
<table>
110
122
<?php
111
123
// This code is repeated twice close to verbatim, any changes should be propagated.