daily pastebin goal
67%
SHARE
TWEET

Duolingo Word Counter Script 2

a guest Mar 21st, 2015 430 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var $words = $('<table><thead><tr><th>Language</th><th>Category</th><th>Word</th><th>Strength</th></thead><table>');
  2. var ld=duo.user.attributes.language_data;
  3. var count = 0;
  4. var waiting = 0;
  5. for(l in ld){
  6.   waiting = ld[l].skills.models.length;
  7.   ld[l].skills.models.forEach(function(e){
  8.     var t=e.attributes;
  9.     if(t.progress_percent>0){
  10.           $.get("/skills/"+t.language+"/"+t.url_title,function(e){
  11.             e.path.forEach(function(e){
  12.                   if(e.words&&e.strength>0){
  13.                     e.words.forEach(function(n){
  14.                           count++;
  15.                           var r="<tr>";r+="<td>"+l+"</td>";
  16.                           r+="<td>"+t.name+"</td>";
  17.                           r+="<td>"+n+"</td>";
  18.                           r+="<td>"+e.strength+"</td>";
  19.                           r+="</tr>";
  20.                           $words.append(r)
  21.                         })
  22.                   }
  23.                 })
  24.                 if(--waiting===0) {
  25.                   $words.append('<tr><td colspan="3">TOTAL</td><td>'+count+'</td></tr>');
  26.                   $('body').html($words);
  27.                 }
  28.           })
  29.         } else {
  30.           waiting--;
  31.         }
  32.   })
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top