Advertisement
URBAN420NETWORK

Untitled

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