Coder Social home page Coder Social logo

thinkphp / request.keywords Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 124 KB

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

Home Page: http://thinkphp.github.com/Request.Keywords/

JavaScript 100.00%

request.keywords's Introduction

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:

request.keywords's People

Contributors

thinkphp avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

request.keywords's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.