Skip to content

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

Notifications You must be signed in to change notification settings

thinkphp/Request.Keywords

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published