├── .htaccess ├── Desktop.ini ├── favicon.ico ├── favicon.png ├── .gitignore ├── images ├── alpha.png ├── back.png ├── blank.png ├── bump.gif ├── bump.png ├── logo.png ├── reset.gif ├── reset.png ├── top1.png ├── remove.png ├── switch.png ├── remove_off.png ├── 4ajax-loader.gif ├── 5ajax-loader.gif ├── ajax-loader.gif ├── ajax-loader2.gif └── ajax-loader3.gif ├── style-handheld.css ├── README ├── inc.php ├── LICENSE ├── style.css ├── scripts ├── pngfix.js └── js.js ├── style-screen.css ├── link.php ├── countr.sql └── index.php /.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | 3 | RewriteRule ^([0-9]+)$ ./?id=$1 -------------------------------------------------------------------------------- /Desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | IconFile=favicon.ico 3 | IconIndex=0 4 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/favicon.ico -------------------------------------------------------------------------------- /favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/favicon.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | old/ 2 | config.php 3 | moofx/ 4 | compliant/ 5 | .DS_Store 6 | **/.DS_Store -------------------------------------------------------------------------------- /images/alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/alpha.png -------------------------------------------------------------------------------- /images/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/back.png -------------------------------------------------------------------------------- /images/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/blank.png -------------------------------------------------------------------------------- /images/bump.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/bump.gif -------------------------------------------------------------------------------- /images/bump.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/bump.png -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/logo.png -------------------------------------------------------------------------------- /images/reset.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/reset.gif -------------------------------------------------------------------------------- /images/reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/reset.png -------------------------------------------------------------------------------- /images/top1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/top1.png -------------------------------------------------------------------------------- /images/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/remove.png -------------------------------------------------------------------------------- /images/switch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/switch.png -------------------------------------------------------------------------------- /images/remove_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/remove_off.png -------------------------------------------------------------------------------- /images/4ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/4ajax-loader.gif -------------------------------------------------------------------------------- /images/5ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/5ajax-loader.gif -------------------------------------------------------------------------------- /images/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/ajax-loader.gif -------------------------------------------------------------------------------- /images/ajax-loader2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/ajax-loader2.gif -------------------------------------------------------------------------------- /images/ajax-loader3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloopletech/countr/master/images/ajax-loader3.gif -------------------------------------------------------------------------------- /style-handheld.css: -------------------------------------------------------------------------------- 1 | .header { border-bottom: 1px solid #000000; background-color: #ffffff; } 2 | .alpha { display: none; } -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Countr is a web 2.0 AJAX-driven web application that allows you to count anything. 2 | 3 | To run the website, you will need to create a file config.php, with contents like so: 4 | 5 | 'localhost', 'username' => 'countr', 'password' => 'oranges', 'database' => 'countr'); 7 | ?> 8 | 9 | Modify the details to suit your MySQL database details, then run web/countr.sql in your database. -------------------------------------------------------------------------------- /inc.php: -------------------------------------------------------------------------------- 1 | 0) 13 | { 14 | $output = array(); 15 | 16 | $row = mysql_fetch_assoc($result); 17 | while($row != NULL) 18 | { 19 | $output[] = $row; 20 | $row = mysql_fetch_assoc($result); 21 | } 22 | 23 | return (count($output) > 1 ? $output : $output[0]); 24 | } 25 | 26 | return NULL; 27 | } 28 | 29 | function esc($str) 30 | { 31 | return mysql_real_escape_string($str); 32 | } 33 | 34 | function usc($str) 35 | { 36 | return stripslashes($str); 37 | } 38 | 39 | ?> 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007-2009 Brenton Fletcher (http://i.bloople.net i@bloople.net) 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | body { font-family: Verdana, "Trebuchet MS", Helvicita, Arial, sans-serif; background-color: #ffffff; color: #000000; 2 | background-image: url(images/back.png); } 3 | 4 | h2 { text-align: center; margin-bottom: 1em; } 5 | h2 input { font-size: 100%; display: none; } 6 | 7 | #id { display: none; } 8 | 9 | .header { } 10 | 11 | .alpha { padding-bottom: 10px; z-index: 5; } 12 | 13 | form { margin: 0; padding: 0; } 14 | 15 | .mast { font-size: 105%; margin-top: 0px; } 16 | .mainbody { padding-left: 1em; padding-right: 1em; } 17 | 18 | .footer { display: block; background-color: #ffffaa; padding: 3px; } 19 | 20 | img { border: 0px; } 21 | 22 | #counttable { background-color: #ffffff; margin-bottom: 1em; } 23 | #counttable td { padding: 0.2em 0.3em; } 24 | #counttable thead td { font-weight: bold; } 25 | 26 | #countbodywrap { margin-left: auto; margin-right: auto; } 27 | 28 | .clear { clear: both; } 29 | .lfloat { float: left; } 30 | .rfloat { float: right; } 31 | 32 | .hidden { display: none; } 33 | 34 | #buttons-wrap { margin-bottom: 1.5em; margin-left: auto; margin-right: auto; } 35 | 36 | #bumpbutton { font-size: 120%; height: 2em; } 37 | 38 | #switchbar { border-top: 1px solid #808080; } 39 | -------------------------------------------------------------------------------- /scripts/pngfix.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Correctly handle PNG transparency in Win IE 5.5 & 6. 4 | http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006. 5 | 6 | Use in with DEFER keyword wrapped in conditional comments: 7 | 10 | 11 | */ 12 | //Modified by Brenton Fletcher November 2006. 13 | 14 | var arVersion = navigator.appVersion.split("MSIE") 15 | var version = parseFloat(arVersion[1]) 16 | 17 | if ((version >= 5.5) && (document.body.filters)) 18 | { 19 | for(var i=0; i"; 36 | img.outerHTML = strNewHTML; 37 | i = i-1; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /style-screen.css: -------------------------------------------------------------------------------- 1 | body { min-height: 100%; font-size: 95%; padding: 0px; margin: 0px; margin-bottom: 10px; } 2 | hr { border: none; height: 1px; background-color: #808080; width: 100%; } 3 | 4 | h2 { font-size: 160%; font-weight: normal; text-align: center; margin-bottom: 1em; margin-top: 0; } 5 | h2 input { font-family: Verdana, "Trebuchet MS", Helvicita, Arial, sans-serif; text-align: left; width: 10em; 6 | display: none; } 7 | 8 | #counttitle:hover { background-color: #ffff00; } 9 | 10 | .header { text-align: left; padding-top: 17px; padding-left: 1em; height: 90px; 11 | background: url(images/top1.png) repeat-x; } 12 | 13 | .alpha { float: right; margin-top: -17px; margin-right: 17px; padding-bottom: 10px; z-index: 5; } 14 | 15 | form > .mast { font-size: 110%; } 16 | .mainbody { padding-left: 1em; padding-right: 1em; } 17 | 18 | img { border: 0px; } 19 | 20 | #counttable { border: 1px solid #000000; border-collapse: collapse; text-align: left; margin: 0; } 21 | #counttable td { padding: 0.2em 0.3em; border: 1px solid #000000; } 22 | #counttable thead td { background-color: #ffa500; color: #000000; } 23 | 24 | #counttablewrap { height: 15em; overflow: auto; padding: 1px; margin-bottom: 1.3em; margin-left: auto; margin-right: auto; border: 1px dashed #a0a0a0; } 25 | 26 | button img, button span { vertical-align: middle; } 27 | 28 | #buttons-wrap { width: 13em; } 29 | 30 | #bumpbutton-wrap { width: 13em; height: 3em; } 31 | #bumpbutton { font-size: 120%; height: 100%; width: 100%; } 32 | #resetbutton-wrap { width: 13em; margin-top: 0.3em; } 33 | #resetbutton { height: 100%; width: 100%; } 34 | 35 | #switchwrap { float: right; border: 1px solid #808080; margin-right: 1em; padding: 0.3em; background-color: #ffffff; 36 | margin-top: -1px; } 37 | #switchwrap a { text-decoration: none; font-size: 80%; color: #000000; } 38 | #switchwrap a span { vertical-align: middle; } 39 | #switchwrap img { vertical-align: middle; } 40 | -------------------------------------------------------------------------------- /link.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /countr.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.11 2 | -- 3 | -- Host: localhost Database: countr 4 | -- ------------------------------------------------------ 5 | -- Server version 5.0.51a-3ubuntu5 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!40101 SET NAMES utf8 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Table structure for table `counter_hits` 20 | -- 21 | 22 | DROP TABLE IF EXISTS `counter_hits`; 23 | SET @saved_cs_client = @@character_set_client; 24 | SET character_set_client = utf8; 25 | CREATE TABLE `counter_hits` ( 26 | `id` bigint(20) NOT NULL auto_increment, 27 | `counter_id` int(11) NOT NULL default '0', 28 | `type` varchar(10) NOT NULL default '', 29 | `when` bigint(20) NOT NULL default '0', 30 | PRIMARY KEY (`id`) 31 | ) ENGINE=MyISAM AUTO_INCREMENT=1104 DEFAULT CHARSET=latin1; 32 | SET character_set_client = @saved_cs_client; 33 | 34 | -- 35 | -- Dumping data for table `counter_hits` 36 | -- 37 | 38 | 39 | -- 40 | -- Table structure for table `counters` 41 | -- 42 | 43 | DROP TABLE IF EXISTS `counters`; 44 | SET @saved_cs_client = @@character_set_client; 45 | SET character_set_client = utf8; 46 | CREATE TABLE `counters` ( 47 | `id` int(11) NOT NULL auto_increment, 48 | `name` varchar(50) NOT NULL default '', 49 | `hits` bigint(20) NOT NULL default '0', 50 | `share` tinyint(4) NOT NULL default '0', 51 | PRIMARY KEY (`id`) 52 | ) ENGINE=MyISAM AUTO_INCREMENT=451796 DEFAULT CHARSET=latin1; 53 | SET character_set_client = @saved_cs_client; 54 | 55 | -- 56 | -- Dumping data for table `counters` 57 | -- 58 | 59 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 60 | 61 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 62 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 63 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 64 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 65 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 66 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 67 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 68 | 69 | -- Dump completed on 2009-11-16 2:04:33 70 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 29 | 30 | 31 | 32 | Countr 33 | 34 | 35 | 36 | 37 | 40 | 41 | 42 | 43 | 44 |
45 | 46 |
47 |
alpha
48 | Countr 49 |
50 | 51 |
52 |
53 | 54 | 55 |
56 |

This page lets you count stuff. Anything you want, cups of coffee, cigarettes, web 2.0 sites :). Just click the "Bump Counter" 57 | button to increase the count. Of course, the count will be saved so you can come back 58 | to this page whenever you want. You can change the title below by just clicking on "<things>". 59 |

60 |
61 | 64 |
65 |
66 |
67 |

0 ? $counter["hits"] : "0");?> counted

68 | 69 |
70 |
71 |
72 |
73 | 74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 0)) 91 | { 92 | $hits = 1; 93 | for($i = 0; $i < count($rows); $i++) 94 | { 95 | $row =& $rows[$i]; 96 | 97 | if($row["type"] == "reset") 98 | { 99 | $row["hits"] = "0"; 100 | $hits = 1; 101 | } 102 | else if($row["type"] == "bump") 103 | { 104 | $row["hits"] = $hits; 105 | $hits++; 106 | } 107 | else if($row["type"] == "creation") 108 | { 109 | $row["hits"] = "0"; 110 | $hits = 1; 111 | } 112 | } 113 | 114 | $rows = array_reverse($rows); 115 | 116 | foreach($rows as $row) 117 | { 118 | ?> 122 | 123 |
CountTypeWhen
style="width: 16px; height: 16px;" />
124 |
125 |
126 |
127 | 128 | 129 | -------------------------------------------------------------------------------- /scripts/js.js: -------------------------------------------------------------------------------- 1 | //Code copyright (c) Brenton Fletcher 2006-2007. 2 | //Check out my portfolio at http://i.budgetwebdesign.org 3 | 4 | function $(ele) 5 | { 6 | var t = document.getElementById(ele); 7 | if(t == null) t = document.getElementsByName(ele); 8 | if(t.length == 1) t = t.item(0); 9 | return t; 10 | } 11 | 12 | function pad(str) 13 | { 14 | str = str + ""; 15 | if(str.length == 0) return "00"; 16 | if(str.length == 1) return "0" + str; 17 | if(str.length == 2) return str; 18 | } 19 | 20 | var http = null; 21 | var callback = null; 22 | 23 | function loadURL(str, inCallback) 24 | { 25 | callback = inCallback; 26 | http.open("get", str, true); 27 | http.onreadystatechange = gotURL; 28 | http.send(null); 29 | } 30 | 31 | function gotURL() 32 | { 33 | if(http.readyState == 4) 34 | { 35 | if(callback != null) 36 | { 37 | callback(http.responseText); 38 | } 39 | } 40 | } 41 | 42 | function editTitle() 43 | { 44 | title = (document.all ? $("counttitle").innerText : $("counttitle").textContent); 45 | $("titleinput").value = title; 46 | $("counttitle").style.display = "none"; 47 | $("titleinput").style.display = "inline"; 48 | 49 | setTimeout(function() { $("titleinput").focus(); }, 50); 50 | } 51 | 52 | function finishedEditTitle() 53 | { 54 | title = $("titleinput").value; 55 | 56 | $("counttitle").innerText = title; 57 | $("counttitle").textContent = title; 58 | $("counttitle").style.display = "inline"; 59 | $("titleinput").style.display = "none"; 60 | 61 | loadURL("link.php?mode=edittitle&title=" + title, null); 62 | } 63 | 64 | function initDates() 65 | { 66 | nodes = $("counttablebody").childNodes; 67 | for(i = 0; i < nodes.length; i++) 68 | { 69 | tr = nodes.item(i); 70 | if(tr.tagName != "TR") continue; 71 | 72 | when = new Date(parseInt(tr.childNodes.item(3).innerHTML)); 73 | tr.childNodes.item(2).innerHTML = pad(when.getDate()) + "-" + pad(when.getMonth() + 1) + "-" + when.getFullYear() + " " 74 | + pad(when.getHours() > 12 ? when.getHours() - 12 : (when.getHours() == 0 ? 12 : when.getHours())) + ":" 75 | + pad(when.getMinutes()) + ":" + pad(when.getSeconds()) + " " + (when.getHours() > 11 ? "PM" : "AM"); 76 | } 77 | } 78 | 79 | var currentWidth = 0; 80 | function initTableWrap() 81 | { 82 | if($("counttable").offsetWidth == currentWidth) return; 83 | 84 | $("counttablewrap").style.width = $("counttable").offsetWidth + 20 + "px"; 85 | currentWindth = $("counttable").offsetWidth; 86 | } 87 | 88 | var allDisabled = false; 89 | 90 | function disableAll() 91 | { 92 | $("bumpbutton").disabled = "disabled"; 93 | $("resetbutton").disabled = "disabled"; 94 | $("changebutton").disabled = "disabled"; 95 | 96 | var imgs = document.getElementsByTagName("img"); 97 | for(i = 0; i < imgs.length; i++) 98 | { 99 | if(imgs[i].src == "images/remove.png") imgs[i].src = "images/remove-off.png"; 100 | } 101 | 102 | allDisabled = true; 103 | } 104 | 105 | function enableAll() 106 | { 107 | $("bumpbutton").disabled = null; 108 | $("resetbutton").disabled = null; 109 | $("changebutton").disabled = null; 110 | 111 | var imgs = document.getElementsByTagName("img"); 112 | for(i = 0; i < imgs.length; i++) 113 | { 114 | if(imgs[i].src == "images/remove-off.png") imgs[i].src = "images/remove.png"; 115 | } 116 | 117 | allDisabled = false; 118 | } 119 | 120 | function bumpCounter() 121 | { 122 | disableAll(); 123 | 124 | when = new Date(); 125 | $("count").innerHTML = parseInt($("count").innerHTML) + 1 + ""; 126 | 127 | var row = $("counttablebody").insertRow(0); 128 | 129 | var count = row.insertCell(-1); 130 | count.innerHTML = $("count").innerHTML; 131 | 132 | var type = row.insertCell(-1); 133 | type.innerHTML = "Bump"; 134 | 135 | var whentd = row.insertCell(-1); 136 | whentd.innerHTML = pad(when.getDate()) + "-" + pad(when.getMonth() + 1) + "-" + when.getFullYear() + " " 137 | + pad(when.getHours() > 11 ? when.getHours() - 12 : when.getHours()) + ":" + pad(when.getMinutes()) + ":" + pad(when.getSeconds()) 138 | + " " + (when.getHours() > 11 ? "PM" : "AM"); 139 | 140 | var whentd2 = row.insertCell(-1); 141 | whentd2.innerHTML = when.getTime(); 142 | whentd2.className = "hidden"; 143 | 144 | var rem = row.insertCell(-1); 145 | rem.innerHTML = ""; 146 | 147 | loadURL("link.php?mode=bump×tamp=" + when.getTime(), function (str) { enableAll(); }); 148 | } 149 | 150 | function resetCounter() 151 | { 152 | disableAll(); 153 | 154 | when = new Date(); 155 | $("count").innerHTML = "0"; 156 | 157 | var row = $("counttablebody").insertRow(0); 158 | 159 | var count = row.insertCell(-1); 160 | count.innerHTML = "0"; 161 | 162 | var type = row.insertCell(-1); 163 | type.innerHTML = "Reset"; 164 | 165 | var whentd = row.insertCell(-1); 166 | whentd.innerHTML = pad(when.getDate()) + "-" + pad(when.getMonth() + 1) + "-" + when.getFullYear() + " " 167 | + pad(when.getHours() > 11 ? when.getHours() - 12 : when.getHours()) + ":" + pad(when.getMinutes()) + ":" + pad(when.getSeconds()) 168 | + " " + (when.getHours() > 11 ? "PM" : "AM"); 169 | 170 | var whentd2 = row.insertCell(-1); 171 | whentd2.innerHTML = when.getTime(); 172 | whentd2.className = "hidden"; 173 | 174 | var rem = row.insertCell(-1); 175 | rem.innerHTML = ""; 176 | 177 | loadURL("link.php?mode=reset×tamp=" + when.getTime(), function (str) { enableAll(); }); 178 | } 179 | 180 | function createCounter() 181 | { 182 | disableAll(); 183 | 184 | when = new Date(); 185 | 186 | var row = $("counttablebody").insertRow(0); 187 | 188 | var count = row.insertCell(-1); 189 | count.innerHTML = "0"; 190 | 191 | var type = row.insertCell(-1); 192 | type.innerHTML = "Creation"; 193 | 194 | var whentd = row.insertCell(-1); 195 | whentd.innerHTML = pad(when.getDate()) + "-" + pad(when.getMonth() + 1) + "-" + when.getFullYear() + " " 196 | + pad(when.getHours() > 11 ? when.getHours() - 12 : when.getHours()) + ":" + pad(when.getMinutes()) + ":" + pad(when.getSeconds()) 197 | + " " + (when.getHours() > 11 ? "PM" : "AM"); 198 | 199 | var whentd2 = row.insertCell(-1); 200 | whentd2.innerHTML = when.getTime(); 201 | whentd2.className = "hidden"; 202 | 203 | var rem = row.insertCell(-1); 204 | rem.innerHTML = ""; 205 | 206 | loadURL("link.php?mode=create×tamp=" + when.getTime(), function (str) { enableAll(); }); 207 | } 208 | 209 | function remove(node) 210 | { 211 | if(allDisabled) return; 212 | disableAll(); 213 | 214 | nodes = node.childNodes; 215 | if(nodes.item(1).innerHTML == "Bump") 216 | { 217 | $("count").innerHTML = parseInt($("count").innerHTML) - 1 + ""; 218 | 219 | tr = node.previousSibling; 220 | while(tr && tr.tagName && tr.tagName == "TR") 221 | { 222 | if(tr.childNodes.item(1).innerHTML == "Bump") 223 | { 224 | tr.childNodes.item(0).innerHTML = parseInt(tr.childNodes.item(0).innerHTML) - 1 + ""; 225 | } 226 | else 227 | { 228 | break; 229 | } 230 | 231 | tr = tr.previousSibling; 232 | } 233 | 234 | loadURL("link.php?mode=remove&type=bump×tamp=" + nodes.item(3).innerHTML, function (str) { enableAll(); }); 235 | } 236 | else if(nodes.item(1).innerHTML == "Reset") 237 | { 238 | hits = 0; 239 | 240 | tr = nodes.item(1).nextSibling; 241 | if(tr && (tr.childNodes.item(1).innerHTML == "Bump")) hits = parseInt(tr.childNodes.item(0).innerHTML) + 1; 242 | 243 | tr = node.previousSibling; 244 | while(tr && tr.tagName && tr.tagName == "TR") 245 | { 246 | if(tr.childNodes.item(1).innerHTML == "Bump") 247 | { 248 | tr.childNodes.item(0).innerHTML = hits + ""; 249 | hits++; 250 | } 251 | else 252 | { 253 | break; 254 | } 255 | 256 | tr = tr.previousSibling; 257 | } 258 | 259 | if(hits == 0) hits = 1; 260 | $("count").innerHTML = hits - 1 + ""; 261 | 262 | loadURL("link.php?mode=remove&type=reset×tamp=" + nodes.item(3).innerHTML, function (str) { enableAll(); }); 263 | } 264 | 265 | $("counttablebody").removeChild(node); 266 | } 267 | 268 | function changeComputer() 269 | { 270 | alert("To use this counter on another computer, use this URL:\nhttp://countr.budgetwebdesign.org/" + (document.all ? $("id").innerText : $("id").textContent)); 271 | } 272 | 273 | function load() 274 | { 275 | if(arguments.callee.done) return; 276 | arguments.callee.done = true; 277 | 278 | try 279 | { 280 | http = new ActiveXObject("Microsoft.XMLHTTP"); 281 | } 282 | catch(e) 283 | { 284 | try 285 | { 286 | http = new XMLHttpRequest(); 287 | } 288 | catch(e) 289 | { 290 | } 291 | } 292 | 293 | initDates(); 294 | setInterval(initTableWrap, 10); 295 | 296 | if($("counttitle").innerHTML == "") editTitle(); 297 | if($("counttablebody").childNodes.length <= 1) createCounter(); 298 | } 299 | 300 | // for Internet Explorer (using conditional comments) 301 | /*@cc_on @*/ 302 | /*@if (@_win32) 303 | document.write("