TiddlyWikiGoogleTagCombinations

Revision as of 22:47, 11 July 2008 by Fridemar (talk | contribs) (preformatted text)



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 as a code-prototype, realized by VartanSimonian.

As it is written in Java-Script, it should be integrated into TiddlyWiki, which is also based on Java-Script.

As both sources are OpenSource, anybody who has time and has 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 within the wider framework of ExtremeOpenBusiness:

// 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>


Retrieved from "http://aboutus.com/index.php?title=TiddlyWikiGoogleTagCombinations&oldid=15948889"