Merge branch 'master' of github.com:kaihendry/Greptweet

Conflicts:
	index.shtml
This commit is contained in:
Kai Hendry
2011-12-04 15:12:52 +01:00
8 changed files with 161 additions and 169 deletions

62
bootstrap-buttons.js vendored Normal file
View File

@@ -0,0 +1,62 @@
/* ============================================================
* bootstrap-buttons.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#buttons
* ============================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function( $ ){
"use strict"
function setState(el, state) {
var d = 'disabled'
, $el = $(el)
, data = $el.data()
state = state + 'Text'
data.resetText || $el.data('resetText', $el.html())
$el.html( data[state] || $.fn.button.defaults[state] )
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}
function toggle(el) {
$(el).toggleClass('active')
}
$.fn.button = function(options) {
return this.each(function () {
if (options == 'toggle') {
return toggle(this)
}
options && setState(this, options)
})
}
$.fn.button.defaults = {
loadingText: 'loading...'
}
$(function () {
$('body').delegate('.btn[data-toggle]', 'click', function () {
$(this).button('toggle')
})
})
}( window.jQuery || window.ender );

View File

@@ -38,13 +38,16 @@ cat <<END
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Fetching tweets of $id</title> <title>Fetching tweets of $id</title>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/style.css"> <link rel="stylesheet" type="text/css" href="/style.css">
</head> </head>
<body> <body>
<div class="container">
<div class="content">
<h1>Greptweet is running a operation to fetch upto 3200 tweets from $id</h1> <h1 class="alert-message info">Fetching upto 3200 tweets from $id</h1>
<p>Please be patient. Closing this page prematurely you can limit the tweets <a href="https://github.com/kaihendry/Greptweet/blob/master/fetch-tweets.sh">fetch-tweets.sh</a> gets and trigger a locking bug.</p> <p class="help-inline">Please be patient. Closing this page prematurely you can limit the tweets <a href="https://github.com/kaihendry/Greptweet/blob/master/fetch-tweets.sh">fetch-tweets.sh</a> gets and trigger a locking bug.</p>
<pre> <pre>
END END
@@ -104,7 +107,9 @@ cd $oldpwd; ./users.sh > users.shtml
cat <<END cat <<END
</pre> </pre>
<h1>Visit <a href="http://$HTTP_HOST/u/$id">http://$HTTP_HOST/u/$id</a></h1> <h1 class="alert-message success">Now to grep fetched tweets, goto <a href="http://$HTTP_HOST/u/$id">http://$HTTP_HOST/u/$id</a></h1>
</div>
</div>
</body> </body>
</html> </html>
END END

View File

@@ -3,21 +3,36 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Grepping twitter backup</title> <title>Grepping twitter backup</title>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/style.css"> <link rel="stylesheet" type="text/css" href="/style.css">
</head> </head>
<body> <body>
<input type="text" name="q" /> <div class="container">
<div class="content">
<ul class="breadcrumb">
<li><a href="/">Home</a> <span class="divider">/</span></li>
<li id="name" class="active">You are here</li>
</ul>
<input type="text" name="q" class="xlarge" />
<button class="btn primary">Greptweet</button>
<div id="results"></div> <div id="results"></div>
<p id="source"></p>
<p>Type a search query like <a href="?foo">foo</a></p> <p class="help-inline">Type a search query like <a href="?foo">foo</a></p>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script async src="/main.js"></script> <script async src="/main.js"></script>
<footer><span id="source"></span></footer>
</div>
</div>
</body> </body>
</html> </html>

View File

@@ -1,15 +1,6 @@
function massage() {
humane.timeout = 5000;
humane("Please wait...");
humane("Still loading...");
}
function submitPressed() { function submitPressed() {
if (document.forms.f.checkValidity()) { if (document.forms.f.checkValidity()) {
b = document.getElementById("b"); $("#b").button('loading');
b.disabled = true;
massage();
document.forms.f.submit(); document.forms.f.submit();
} }
} }

View File

@@ -3,28 +3,68 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>GrepTweet</title> <title>GrepTweet</title>
<link id='theme' rel='stylesheet' href='themes/bigbox.css'/> <link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">
<script src="humane.min.js" async></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="index.js" async></script> <script src="bootstrap-buttons.js"></script>
<script src="index.js"></script>
</head> </head>
<body> <body>
<form name="f" action="create.cgi" method="get">
<fieldset> <div class="container">
<legend>Create or update a backup of your tweets, so you can grep them</legend>
<p><label>Twitter username: <input type="text" name="id" required placeholder="kaihendry"></label></p> <div class="content">
<p><input type="checkbox" name="o" />Try get older tweets, instead of newer tweets when updating</p> <div class="page-header">
<button id="b" onclick="submitPressed()">Fetch tweets</button> <h1><a href="http://twitter.com/greptweet">@Greptweet</a> <small>Grep your tweets</small></h1>
</fieldset> </div>
<div class="row">
<div class="span10">
<form name="f" action="create.cgi" method="get" class="form-stacked">
<div class="clearfix">
<label for="username">Twitter username</label>
<div class="input">
<input class="xlarge" id="username" type="text" name="id" size="16" required placeholder="kaihendry">
</div>
</div>
<ul class="inputs-list">
<li>
<label>
<input type="checkbox" name="o" />
<span>Get older tweets, instead of newer tweets when updating</span>
</label>
</li>
</ul>
<div class="well">
<button class="btn large primary" id="b" data-loading-text="Fetching tweets..." onclick="submitPressed()">Fetch tweets</button>
<span class="help-inline">First fetch tweets to search "grep" them</span>
</div>
</form> </form>
</div>
<div class="span4">
<h3>Greppable tweeters</h3>
<!--#include virtual="users.shtml" --> <!--#include virtual="users.shtml" -->
</div>
</div>
<footer>
<p>Please follow <a href="https://twitter.com/greptweet">@greptweet</a> for <p>Please follow <a href="https://twitter.com/greptweet">@greptweet</a> for
updates and <a href="https://github.com/kaihendry/Greptweet">contribute to the updates and <a href="https://github.com/kaihendry/Greptweet">contribute to the
source on Github!</a></p> source on Github</a></p>
</footer>
</div>
</div>
</body> </body>
</html> </html>

View File

@@ -1,7 +1,7 @@
function grep(query) { function grep(query) {
$.getJSON("/u/" + NAME + "/grep.php?q=" + query + "&jsoncallback=?", function(data) { $.getJSON("/u/" + NAME + "/grep.php?q=" + query + "&jsoncallback=?", function(data) {
var results = "<p>Searched for: " + query + "</p><ol>"; var results = "<p class=\"label\">Searched for: " + query + "</p><ol>";
for (var i in data) { for (var i in data) {
tweet = data[i].split('|'); tweet = data[i].split('|');
if (tweet.length > 2) { if (tweet.length > 2) {
@@ -18,6 +18,7 @@ function grep(query) {
$(document).ready(function() { $(document).ready(function() {
NAME = window.location.pathname.split('/')[2]; NAME = window.location.pathname.split('/')[2];
$("#name").html(NAME);
$("input[type=text]").change(function() { $("input[type=text]").change(function() {
query = this.value; query = this.value;
@@ -34,6 +35,7 @@ $(document).ready(function() {
$("input[type=text]").focus(); $("input[type=text]").focus();
$("#source").html('<a href="' + NAME + '.txt">' + NAME + ' simple text backup file</a>'); $("#source").html('<a href="' + NAME + '.txt">' + NAME + ' simple text backup file</a>');
document.title = "Greptweet " + NAME;
}); });

View File

@@ -1,18 +1,19 @@
body {
font: 1.2em 'Lucida Grande',sans-serif;
}
footer {
font-size: small; margin: 2em;
}
input[type=text] {
font-size: 2em;
border:1px solid #A78B53;
}
button {
font-size: 3em;
}
#users li { display: inline; } #users li { display: inline; }
html, body {
background-color: #eee;
}
/* The white background content wrapper */
.content {
background-color: #fff;
padding: 20px;
margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */
-webkit-border-radius: 0 0 6px 6px;
-moz-border-radius: 0 0 6px 6px;
border-radius: 0 0 6px 6px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.15);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.15);
box-shadow: 0 1px 2px rgba(0,0,0,.15);
}

View File

@@ -1,124 +0,0 @@
html,
body {
height: 100%;
}
.humane {
position: fixed;
-moz-transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
z-index: -1;
}
.humane.humane-animate,
.humane.humane-js-animate {
z-index: 100000;
}
.humane {
font-family: Ubuntu, Verdana, sans-serif;
line-height: 40px;
font-size: 35px;
top: 25%;
left: 25%;
opacity: 0;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
width: 50%;
min-height: 40px;
padding: 30px;
text-align: center;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADICAYAAAAp8ov1AAAABmJLR0QA/wD/AP+gvaeTAAAAc0lEQVQokb2RQQ6EMAwDx/7/n80BtIEC3RYhLlXrVLGTAYiBWBIGtkPSP01SfreTVoV5re9Rcee1scwDk9NurbR62sZJcpzy9O+2X5KsXabyPaQFYNuvkqkRviDTp9Vs8opC0TpkHvJtVjeReW/5kEyX1gKeLEKE9peeWAAAAABJRU5ErkJggg==');
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #000), color-stop(1, rgba(0,0,0,0.90))) no-repeat;
background: -moz-linear-gradient(top, #000 0%, rgba(0,0,0,0.90) 100%) no-repeat;
background: -webkit-linear-gradient(top, #000 0%, rgba(0,0,0,0.90) 100%) no-repeat;
background: -ms-linear-gradient(top, #000 0%, rgba(0,0,0,0.90) 100%) no-repeat;
background: -o-linear-gradient(top, #000 0%, rgba(0,0,0,0.90) 100%) no-repeat;
background: linear-gradient(top, #000 0%, rgba(0,0,0,0.90) 100%) no-repeat;
*background-color: #000;
color: #fff;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
-ms-border-radius: 15px;
-o-border-radius: 15px;
border-radius: 15px;
text-shadow: 0 -1px 1px #ddd;
-moz-box-shadow: 0 15px 15px -15px #000;
-webkit-box-shadow: 0 15px 15px -15px #000;
-ms-box-shadow: 0 15px 15px -15px #000;
-o-box-shadow: 0 15px 15px -15px #000;
box-shadow: 0 15px 15px -15px #000;
-moz-transform: scale(0.1);
-webkit-transform: scale(0.1);
-ms-transform: scale(0.1);
-o-transform: scale(0.1);
transform: scale(0.1);
}
.humane p,
.humane ul {
margin: 0;
padding: 0;
}
.humane ul {
list-style: none;
}
.humane.humane-info {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADICAYAAAAp8ov1AAAABmJLR0QA/wD/AP+gvaeTAAAAQElEQVQokWNgYEj5z8TAwPCfiYGBgQGVIEKMTG2DTYwRVez/IHIaNcUGyBnYgpORel6gpvFEJhBqpxIaG8/AAADsKDq/HhYQ2AAAAABJRU5ErkJggg==');
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #000064), color-stop(1, rgba(0,0,100,0.90))) no-repeat;
background: -moz-linear-gradient(top, #000064 0%, rgba(0,0,100,0.90) 100%) no-repeat;
background: -webkit-linear-gradient(top, #000064 0%, rgba(0,0,100,0.90) 100%) no-repeat;
background: -ms-linear-gradient(top, #000064 0%, rgba(0,0,100,0.90) 100%) no-repeat;
background: -o-linear-gradient(top, #000064 0%, rgba(0,0,100,0.90) 100%) no-repeat;
background: linear-gradient(top, #000064 0%, rgba(0,0,100,0.90) 100%) no-repeat;
*background-color: #030;
}
.humane.humane-success {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADICAYAAAAp8ov1AAAABmJLR0QA/wD/AP+gvaeTAAAAPklEQVQokWNgSGH4z8TAACEYUAkixMjUNsjEGFHF/g8ip1FVbGCcgS04GannBaoaT1wCwWkvmXbQ2HgGBgYA8Yw6v+m4Kh8AAAAASUVORK5CYII=');
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #006400), color-stop(1, rgba(0,100,0,0.90))) no-repeat;
background: -moz-linear-gradient(top, #006400 0%, rgba(0,100,0,0.90) 100%) no-repeat;
background: -webkit-linear-gradient(top, #006400 0%, rgba(0,100,0,0.90) 100%) no-repeat;
background: -ms-linear-gradient(top, #006400 0%, rgba(0,100,0,0.90) 100%) no-repeat;
background: -o-linear-gradient(top, #006400 0%, rgba(0,100,0,0.90) 100%) no-repeat;
background: linear-gradient(top, #006400 0%, rgba(0,100,0,0.90) 100%) no-repeat;
*background-color: #030;
}
.humane.humane-error {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADICAYAAAAp8ov1AAAABmJLR0QA/wD/AP+gvaeTAAAAPklEQVQokWNIYWD4z8QAJRhQCSLEyNQ2uMQYUcX+DyKnUVdsQJyBLTgZqecF6hpPVALBaS+ZdtDYeAYGBgYA9vA6v4OR3MkAAAAASUVORK5CYII=');
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #640000), color-stop(1, rgba(100,0,0,0.90))) no-repeat;
background: -moz-linear-gradient(top, #640000 0%, rgba(100,0,0,0.90) 100%) no-repeat;
background: -webkit-linear-gradient(top, #640000 0%, rgba(100,0,0,0.90) 100%) no-repeat;
background: -ms-linear-gradient(top, #640000 0%, rgba(100,0,0,0.90) 100%) no-repeat;
background: -o-linear-gradient(top, #640000 0%, rgba(100,0,0,0.90) 100%) no-repeat;
background: linear-gradient(top, #640000 0%, rgba(100,0,0,0.90) 100%) no-repeat;
*background-color: #300;
}
.humane.humane-animate {
opacity: 1;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
-moz-transform: scale(1);
-webkit-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
.humane.humane-animate:hover {
opacity: 0.6;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=60);
-moz-transform: scale(0.8);
-webkit-transform: scale(0.8);
-ms-transform: scale(0.8);
-o-transform: scale(0.8);
transform: scale(0.8);
}
.humane.humane-js-animate {
opacity: 1;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
-moz-transform: scale(1);
-webkit-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
.humane.humane-js-animate:hover {
opacity: 0.6;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=60);
}