The forgotten Milk

LifeHacks + Coding = HappyLife

6/27/2007

How to make one Google Blog Search Form in your blog

Google blog search service is one nice search engine. And you can search articles in one special blog by "keyword blogurl:http://blogurl/". For the blogger. It is better than Google Customize Search.


How to make one Google Blog Search Form in your blog? You need only put the below code into your blog template. And replace the variable - site with your blog url. You can download the code from here

<script type="text/javascript">
function searchblogs() {
var q = document.getElementById("searchbox_googleblog_q").value;
var site = "terababy.blogspot.com";
var href = "http://blogsearch.google.com/blogsearch?hl=en&newwindow=1&safe=off&rls=org.mozilla%3Aen-US%3Aofficial&amp;amp;amp;amp;ie=UTF-8&oe=UTF-8&um=1&tab=wb&oi=revisions_inline&resnum=0&ct=property-revision&cd=1&q=" + q+ "+blogurl%3Ahttp%3A%2F%2F" + site + "%2F&btnG=Search+Blogs";
window.open (href , '_blank');
}
</script>

<form id="searchbox_googleblog" onsubmit="javascript:searchblogs();return false;">
<input id="searchbox_googleblog_q" style="margin: 4px 0 0 1px;padding: 1px 0 0 2px;border: 2px solid #919191;width=120px;height=16px; " name="q" type="text"/>
<input value="Search" name="sa" onclick="javascript:searchblogs();" type="button"/>
</form>
For example, you can search my articles in the head of my blog.

Labels: , ,

6/24/2007

How to share articles from GoogleReader to Twitter

When reading articles in GoogleReader, how to share the nice articles to Twitter at a rapid? I made one GreaseMonkey script for that, and you can now.

The format of messages
[Tag] Title(Note) URL

The basic function

  • Tag\title\URL are received from articles in GoogleReader automatically. And you can edit them.
  • URL can be converted into tinyURL.
  • Before sending the messages, the words number will be counted.

The installation order

i. Install the browser - firefox
http://www.mozilla.com/en-US/
ii. Install the plugin - GreaseMonkey
http://addons.mozilla.org/en-US/firefox/addon/748
iii. Install this script
http://userscripts.org/scripts/show/10169


The specification

1. the link "Share with twitter"

After installing the script, open GoogleReader. Below each article, one link "Share with twitter" is added in the toolbar.



2. one mini window

Click the link, one mini window will popup. There are four inputboxes: Title, Tags, URL, and Note. Tag\title\URL are received from articles in GoogleReader automatically. And you can edit them. If you want to talk about it yourself, please input in "Note".



3. four buttons

  • Save - send the message to twitter
  • TinyURL - make the long url tiny. Once you click it, please wait the URL changing from "making urlurl tiny..." to one tiny url
  • Count - count the words' number
  • Cancel - close the mini windows




4. the user authentication

When you send the first message, one authentication is required. Please use your registered username or email address as the username component.

5. show the messages shared



You can install the script here:
http://userscripts.org/scripts/show/10169

Labels: , ,

5/31/2007

Create Document Map on common txt in UltraEdit

UltraEdit is an text, HTML and HEX editor, and an advanced PHP, Perl, Java and JavaScript editor for programmers. One important and popular feature is the function list. But when processing common txt file, no function list. You need customize the "wordfile.txt".
Please open the wordfile.txt in the UltraEdit install directory. And append the below characters.


/L14"TXT" Noquote Line Comment = # Line Comment Num = 5Note: Block Comment On = /* Block Comment Off = */ File Extensions = TXT
/Delimiters = !&*()+=|/;"'<>:@ ,./
/Function String = "%[0-9].*"


It can process the titles like "1.", "1.1" as document map.


And I wrote one reference for each language in the default wordfile and share it here.

Labels: ,

5/27/2007

How to share your blog in Blogger site

Web2.0 is share. It is necessary to share your blog as one blogger. But in the Blogger space, it is hard to modify the template to add the share feature. For example, when you create share links with images, the images will auto turn into the strange style: one image by one line. When you meet this problem, please use table, tr, td elements.

Another tip we need to know, the Bookmark Services commonly provide API to add the bookmark from external. The API contain two parts. The first is URL, the second is title. Of course, for the different API, the parameter names for URL and title are different. For example, the API for "del.icio.us" is "http://del.icio.us/post?url=XXX&title=YYY". The one for "My Yahoo" is "http://myweb2.search.yahoo.com/myresults/bookmarklet?u=XXX&t=YYY".

This is the code I wrote for sharing links:

<p>
<table><tr>
<td>Share this:</td>

<!-- share link for del.icio.us -->
<td><a expr:href='"http://del.icio.us/post?url=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"del.icio.us: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/delicious.gif'/></a></td>

<!-- share link for Digg -->
<td><a expr:href='"http://digg.com/submit?phase=2&amp;url=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"digg: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/digg.gif'/></a></td>

<!-- share link for Technorati -->
<td><a expr:href='"http://technorati.com/cosmos/search.html?url=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"Technorati: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/technorati.gif'/></a></td>

<!-- share link for Reddit -->
<td><a expr:href='"http://reddit.com/submit?url=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"Reddit: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/reddit.gif'/></a></td>

<!-- share link for Stumbleupon -->
<td><a expr:href='"http://www.stumbleupon.com/submit?url=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"stumbleUpon: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/stumbleupon.png'/></a></td>

<!-- share link for My Yahoo -->
<td><a expr:href='"http://myweb2.search.yahoo.com/myresults/bookmarklet?u=" + data:post.url + "&amp;t=" + data:post.title' expr:title='"My Yahoo!: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/yahoo_myweb.gif'/></a></td>

<!-- share link for Blinklist -->
<td><a expr:href='"http://blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=" + data:post.url + "&amp;Title=" + data:post.title' expr:title='"Blinklist: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/blinklist.gif'/></a></td>

<!-- share link for Furl -->
<td><a expr:href='"http://furl.net/storeIt.jsp?u=" + data:post.url + "&amp;t=" + data:post.title' expr:title='"Furl: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/furl.gif'/></a></td>

<!-- share link for Tipstrs -->
<td><a expr:href='"http://www.tipstrs.com/addTip"' expr:title='"Tipstrs: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/tipstrs.gif'/></a></td>

<!-- share link for Netscape -->
<td><a expr:href='"http://www.netscape.com/submit/?U=" + data:post.url + "&amp;T=" + data:post.title' expr:title='"Netscape: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/netscape.gif'/></a></td>

<!-- share link for Google Bookmarks -->
<td><a expr:href='"http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"Google Bookmarks: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/google_bmarks.gif'/></a></td>

<!-- share link for ma.gnolia -->
<td><a expr:href='"http://ma.gnolia.com/bookmarklet/add?url=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"Ma gnolia: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/magnolia.gif'/></a></td>

<!-- share link for Newsvine -->
<td><a expr:href='"http://www.newsvine.com/_wine/save?u=" + data:post.url + "&amp;h=" + data:post.title' expr:title='"Newsvine: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/newsvine.gif'/></a></td>

<!-- share link for Tailrank -->
<td><a expr:href='"http://tailrank.com/share/?link_href=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"Tailrank: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/tailrank.gif'/></a></td>

<!-- share link for live.com -->
<td><a expr:href='"https://favorites.live.com/quickadd.aspx?marklet=1&amp;mkt=en-us&amp;url=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"Windows live: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/windows_live.gif'/></a></td>

<!-- share link for Simpy -->
<td><a expr:href='"http://www.simpy.com/simpy/LinkAdd.do?href=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"Simpy: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/simpy.gif'/></a></td>

<!-- share link for Spurl -->
<td><a expr:href='"http://www.spurl.net/spurl.php?url=" + data:post.url + "&amp;title=" + data:post.title' expr:title='"Windows live: " + data:post.title' target='_blank'><img src='http://i189.photobucket.com/albums/z223/wawatera/spurl.gif'/></a></td>


</tr></table>
</p>

Labels: ,

5/13/2007

My first MonkeyScript

I was so amazed with the script plugins on firefox. Yeah! They enhance the website UI so much!
Now I use GreaseMonke and Stylish for GoogleReader, Gmail, last.fm, DeviantArt, Flickr, Hotmail, Download.com, Twitter, Photobucket and so on.


I am a Naruto fan. And I found one online comic site about Naruto. But one block of advertiesment make me crazy! Who can bear this?

So the impulse to write one script to hide the block come out from my brain.

After read some source scripts, I wrote as the below:












// ==UserScript==
// @name 1mh comic
// @description Say goodbye to Demonoid's most annoying ads ever. (v1.1)
// @include http://www.1mh.org/html/*
// ==/UserScript==

var adContainer = document.getElementsByTagName('table')[0];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

adContainer = document.getElementsByTagName('table')[1];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

adContainer = document.getElementsByTagName('table')[2];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

adContainer = document.getElementsByTagName('table')[5];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

adContainer = document.getElementsByTagName('table')[6];
if (adContainer)
adContainer.parentNode.removeChild(adContainer);

--------------------------------------------------------------------

Yes, I only keep the 3rd(image) and 4th(page control) table. So simple! The script is dirty, but I needn't make it clean.

After install my script, the result page display so clean.




















So cool! Ok, let's code anywhere and anytime.

Labels: ,