Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

This is a quick hack based on MooTools which tries to find keywords connected to a certain term.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 Docs
Octocat-spinner-32 Source
Octocat-spinner-32 demo
Octocat-spinner-32 README.md
Octocat-spinner-32 package.yml
README.md

Request.Keywords

Request.Keywords is plugin MooTools which tries to find keywords connected to a certain term.

Screenshot

How to use

First you must to include the JS files in the head of your HTML document.

   #HTML
   <script type="text/javascript" src="core.js"></script>
   <script type="text/javascript" src="jsonp.js"></script>
   <script type="text/javascript" src="Request.Keywords.js"></script>

In your JavaScript source:

   #JS 
   window.addEvent('domready',function(){ 
         new Request.Keywords('mootools', 'us', 'en', {
                                  onSuccess: function(o) {
                                       if(window.console) {console.log(o);}
                                         if(o.query.results.keywords) {
                                              var term = o.query.results.keywords.search;
                                              var kw = o.query.results.keywords.terms;
                                              var language = o.query.results.keywords.language;
                                              var region = o.query.results.keywords.region;
                                              var out = '<h2>You searched for <span>'+term+'</span> in <span> '+ language +'</span></h2>'+
                                                   '<p>We found these related keywords:</p>'+
                                                   '<p class="termslist">'+kw.replace(/,/g,', ')+'</p>';
                                               $('keywords').set('html',out);
                                         } else {
                                               $('keywords').set('text','There was an error, please try again.');
                                         }
                                  },
                                  onRequest: function(script) {
                                       if(window.console) {console.log(script);}
                                       $('keywords').set('text','Loading...');
                                  }
        }).send();              

        $('another_keywords').loadKeywords('python');
  }

In your HTML source:

   #HTML
   <div id="keywords"></div>
   <div id="another_keywords"></div>

Dependencies

  MooTools Core 1.3.0
  MooTools More: Request.JSONP

Notes:

You can view in action:

Something went wrong with that request. Please try again.