Advertisement
URBAN420NETWORK

Untitled

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