Brewing Google Flip in Home : Primitive google flip implementation
More than a “Paper Experience”, the fast flips of pages that got me hooked to google flip. But, there are hundreds of blogs and and sites that wish to see every day which google flip does not cover.
After a little bit of research i found out excellent tools like CutyCapt and IECapt are already there in sf.net. The effect of flip are very cheap in market, jQuery based gallery application being the first chice; see galleria and galleriffic.
Implementation
A dirty script to generate the image generator and gallery. It reads bookmark.txt to grab urls and generate the script to scrub the image using cutycapt.exe.
It as well generates a list of anchors at the top of the template page.
public class FastFlip {
public static void main(String[] args) throws Exception {
int siteNumber = 0;
BufferedReader reader = new BufferedReader(new FileReader("bookmark.txt"));
String str;
String html = "";
String batch = "";
while ((str = reader.readLine()) != null) {
html += "<li> <a href="%5C%22javascript:fire%28%22+" sitenumber="" ,="" str="" +="" );\=""> <img src="%5C%22sites/icon.gif%5C%22" title="\""" str="" +="" \=""></a></li>";
batch += "CutyCapt.exe --url=" + str + " --out=sites/" + siteNumber + ".png\r\n";
siteNumber++;
}
PrintStream batFile = new PrintStream("scrub.bat");
batFile.print(batch);
batFile.close();
BufferedReader tempReader = new BufferedReader(new FileReader("template.html"));
PrintStream out = new PrintStream("index.html");
while ((str = tempReader.readLine()) != null) {
if (str.indexOf("INSERT_LI_HERE") != -1) {
out.println(html);
} else {
out.println(str);
}
}
out.close();
tempReader.close();
}
}
template.html
<style type="text/css">
#header{
width:900px;
border:1px #c0c0c0 solid;
height:128px;
margin-left:auto;
margin-right:auto;
margin-bottom:5px;
}
#thumbs {
display:block;
text-align:left;
padding:0;
margin:0;
}
#thumbs li{
display: inline-block;
float:left;
width:32px;
height:32px;
border:1px #c0c0c0 dashed;
padding:0;
margin:0;
}
#thumbs li a img{
border:0;
}
#content{
width:1200px;
border:1px #c0c0c0 solid;
margin-left:auto;
margin-right:auto;
margin-bottom:5px;
margin-top:10px;
text-align:center;
}
#content a img{
border:0;
}
</style>
<!-- YOU CANNOT GET SIMPLER THAN THIS -->
<script language="javascript">
function fire(a){
document.getElementById('content').innerHTML = '<a href = "javascript:fire(' + (a+1) + ')"><img src="sites/' + a + '.png"></a>';
}
</script>
<div id="header">
<ul id="thumbs">
INSERT_LI_HERE
</ul>
</div>
<div id="content">
</div>
Finally created a small batch utility that is fired every 30 minutes using windows Task Scheduler.
cd C:\Users\Anil\Desktop\archives\home java FastFlip scrub.bat
Comments
Whoa. Cool. I have to try this out