Advertisement
URBAN420NETWORK

Untitled

Aug 29th, 2017
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. if(typeof(window.___loaded) == 'undefined') {
  2. window.___loaded = true;
  3. setInterval(function() {
  4. if(document.location.pathname.split('/')[2] == 'learn') {
  5. var definition = "";
  6. var tdfs = document.getElementsByClassName("FormattedText notranslate TermText lang-photo");
  7. if(tdfs.length >= 1) {
  8. definition = tdfs[0].innerText;
  9. } else {
  10. definition = $('.Image-image').attr('src')
  11. }
  12. var terms = Quizlet.assistantModeData.terms;
  13. for(var i = 0; i < terms.length; i++) {
  14. if(terms[i].definition == definition || terms[i]._imageUrl == definition) {
  15. $(".UITextarea-label").children().html("TYPE <u>" + terms[i].word + "</u>");
  16. $('.TermText').filter(function () {
  17. return $(this).text() == terms[i].word;
  18. }).click();
  19. }
  20. }
  21. } else if(document.location.pathname.split('/')[2] == 'write') {
  22. if(document.getElementById('user-answer') != null) {
  23. document.getElementById('user-answer').value = Game.curTerm.word;
  24. document.getElementById('js-learnModeAnswerButton').click();
  25. }
  26. } else if(document.location.pathname.split('/')[2] == 'spell') {
  27. if(document.getElementById('js-spellRoundAnalysis').style.display == "none"
  28. && document.getElementsByClassName("UITextarea-label")[0].innerText == "ANSWER") {
  29. Game.beatTerm();
  30. }
  31. } else if(document.location.pathname.split('/')[2] == 'test') {
  32. var ts = $('.TestModeSection-questionItem').find("textarea");
  33. var terms = Quizlet.TestModeData.terms;
  34.  
  35. for(var i = 0; i < ts.length; i++) {
  36. var t = ts[i];
  37. var definition = "";
  38. var im = $(t.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[0]).find('img').attr('src');
  39. if(typeof(im) != 'undefined')
  40. definition = im;
  41. else
  42. definition = t.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.children[0].innerText;
  43.  
  44. for(var j = 0; j < terms.length; j++) {
  45. if(terms[j].definition == definition || terms[j]._imageUrl == definition) {
  46. $(t.parentElement.parentElement.parentElement.parentElement.children[1]).html("type <u>" + terms[j].word + "</u>");
  47. }
  48. }
  49. }
  50. } else if(document.location.pathname.split('/')[2] == 'match') {
  51. var ts = $('.MatchModeQuestionScatterTile');
  52. var terms = Quizlet.matchModeData.terms;
  53.  
  54. for(var i = 0; i < ts.length; i++) {
  55. var t = $(ts[i]);
  56. var definition = "";
  57. var im = t.find('img').attr('src');
  58. if(typeof(im) != 'undefined')
  59. definition = im;
  60. else
  61. definition = t.text();
  62.  
  63. for(var j = 0; j < terms.length; j++) {
  64. if(terms[j].definition == definition || terms[j]._imageUrl == definition || terms[j].word == definition) {
  65. t.css({ 'background': '#' + Math.floor((Math.abs(Math.sin(j) * 16777215)) % 16777215).toString(16) });
  66. }
  67. }
  68. }
  69. }
  70. }, 1);
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement