TiddlyWikiGoogleTagCombinations
Contents
Intro
From TiddlyWiki
GoogleTagCombinations allow to setup complex queries for social exploring and filtering in a wiki-context. It's an idea of FridemarPache, first published in Meatball:GoogleTagWiki and has a code-prototype, realized by VartanSimonian. See also User_talk:VartanSimonian
As it is written in Java-Script, it should be integrated into TiddlyWiki, which is also based on Java-Script.
Since both sources are OpenSource, anybody who has time and some experience with TiddlyWiki, is invited to make it a plugin of TiddlyWiki.
This increases the value of TiddlyWiki for social collaboration, not only in SharedEcommerce which is a new initiative within the wider framework of ExtremeOpenBusiness:
The code-prototype
// JavaScript Document //<script type="text/javascript"> //<!-- /* Linklist variable contains list of selected links */ var linklist = ''; /* SearchPrefix - search URL (customizable search engine) before Search Query */ var SearchPrefix='http://www.google.com/search?q=' /* SearchSuffix - search URL (customizable search engine) after Search Query */ var SearchSuffix='&hl=en'; /* FP_getObjectByID - cross-browser get object by id (made by expression web aka frontpage) */ function FP_getObjectByID(id,o) {//v1.0 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id); else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el; if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c) for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; } f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements; for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } } return null; } /* doCheck - will toggle between whether link is selected for searching or not * sender - check box triggering this function * link - link text */ function doCheck(sender, link) { if (linklist.match(escape(link)) == null) { //if link has been selected already //.. fp linklist += ',' + escape(link); //add link to link list sender.checked = true; /*make sure that checkbox is checked, in case the user returned to the page via the browser's back button, but the browser remembered only the checkbox value */ } else { //if the link has been selected // linklist = linklist.replace(new RegExp("," + escape(link), "gi"), ""); /* linklist = linklist.replace("," + escape(link), ""); /* .. fp: do we really need Regs and case-insensitivity remove link from link list*/ sender.checked = false; /*make sure that checkbox is unchecked, in case the user returned to the page via the browser's back button, but the browser remembered only the checkbox value */ } } function goSearch() { // launches the Search with the TagCombination as Search Term var links = linklist.split(','); // creates an array of the checked links based on linklist var searchUrl = SearchPrefix; // the Google search term .. for (var x in links) { // .. successively filled with the checked links searchUrl += links[x] + '+'; // the last superfluous plus-sign doesn't do any harm } location.href = searchUrl + SearchSuffix; // start the combined Google search } var quoteChar="\""; function quote(s) { return quoteChar+s+quoteChar; } var ahref="<a href=\""; var searcher="test"; var GoogleIcon="http://images.aboutus.org/images/1/18/GoogleIcon.png"; var QuotedGoogleIcon=quote(GoogleIcon); function g(s,t) { // GoogleDoubleLinkWithOptionbox //document.writeln("<a href="+ quote(SearchPrefix + quote(s))+ "> "); //document.writeln("<img src=" + quote(GoogleIcon) + " alt="+quote("(Google)") + " style="+quote("border-style: none;") +" /></a>"); document.write("<input type=\"checkbox\" onclick=\"doCheck(this," + "\'"+s + "\'" + ");\"" + " />"); document.write(" <a href=\"http://AboutUs.org/" + s + "\"" + ">" + s + "</a>"); // document.write("<XMP>") document.write(" " + t +" "); // document.write("</XMP>") }; // --> //</script>
An application example
You can see, test and download the following application example in real life at Meatball:GoogleTagWiki.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Link text</title> <script src="GoogleTag.js"></script> </head> <body> <a name="top"></a> <button onClick="goSearch();">Click here to search for a GoogleTagCombination!</button> <p /> <script> /*g("WikiTag"); g("TagCombination"); g("GoogleTag"); g("GoogleTagCombination"); g("TagWiki"); g("GoogleTagWiki"); g("AboutUs"); g("Vartan"); g("TedErnst"); g("fridemar"); gap(3); */ g("WikiTag","is the WikiWord replacement, allowing combined searches. Several WikiTags form a"); g("TagCombination","i.e. one or more checked OptionBoxes form a TagCombination. A"); g("GoogleTag","A CamelCase search term, that can be combined with other such terms."); g("GoogleTagCombination","is a TagCombination for Google searches"); g("TagWiki","is a Wiki, where WikiTags replace WikiWords"); g("GoogleTagWiki","A wiki, whose WikiWords are GoogleTags."); g("AboutUs","A giant wiki, for open collaboration."); g("Vartan","is the young script programmer of this prototype in AboutUs.Org ."); g("TedErnst","motivated Vartan, to make the prototype."); g("fridemar","initiated the idea and is a bit messing around with Vartan's code. ;-)"); </script> </body> </html>
An answer to a TiddlyWiki Developer (newsgroup member)
On [[1]] (GoogleGroup:TiddlyWikiDev:GoogleTagCombinations) Fridemar asked:
Dear developers, who is interested to integrate the JavaScript of Vartan into TiddlyWiki. See http://aboutus.org/TiddlyWikiGoogleTagCombinations for details.
and Tobias Beer answered:
Subject: Re: GoogleTagCombinations as extension wanted. Is that intended to replace internal wiki link's with external ones? If so, I don't find the idea very propelling, besides I don't think googles indexes get updated this often, or do I misunderstand the concept? Wouldn't you rather want to do things like that with a "simple" firefox plugin like "hyperwords"? Why would you want that in the wiki site itself? Isn't that a bit too much googlifying the whole web?
Thank you Tobias for giving me and other interested peers the opportunity to elaborate a bit on this:
You understand me right, that there is even more potential in it, than "only" replacing the internal wiki links by it. In TiddlyWiki, I suggest, to extend the parser a bit, to allow embedded GoogleTagCombinations, as e.g.
$GoogleSearchTerm1,Comment1 ....some text ... $GoogleSearchTerm2,Comment2 .. etc,
for calling the above defined (and to be improved) function g that call g("GoogleSearchTerm1",Comment1) ....some text ... g("GoogleSearchTerm2",Comment2) ....etc.
These interspersed calls produce (in the TiddlyWiki view-mode) option boxes, that can be (un-)checked by the users and used as a Google query by clicking an additional command-link, that is added to the line, where you have already: "edit","done", ... : This way the new command line shows up as: "edit","done","search", ... For convenience, "search" should only be shown, if there is at least one GoogleSearchTerm defined.
Another good idea, you imply, is: that we should have a "dual use" for the GoogleTagCombinations, similar to the following example, that is handled in the Aboutus wiki: G TiddlyWiki. With one marker you get at the same time, two links: one pointing to Google and the other one, to an internal wiki link. Now think this latter template tool generalized to arbitrary (Google-) Tag Combinations and you see the power of this construct and how useful it is for (collective) filtering (in communities). fridemar 05:04, 16 July 2008 (PDT)