Giter VIP home page Giter VIP logo

Comments (28)

KaBankz avatar KaBankz commented on July 18, 2024

Unfortunately, if it does stop working I will no longer be able to fix it because I no longer have access to my pupilpath account.

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

I appreciate the effort, but I don't think it's safe to share your account with anyone besides yourself. You are free to fork this repo and work on it yourself. If you want to learn how to code this script, I recommend you google javascript tutorials and start learning from the basics.

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

To change something on a website requires you to manipulate the DOM with javascript. If you go to youtube and watch some videos on DOM manipulation with javascript you should be set.

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

Hacking pupilpath from the inside would be more difficult than necessary and illegal. Just bring your grades up instead of becoming a criminal. This userscript is for those times when you just want to flex better grades or just calculate an average.

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

Opps, my bad for the misinterpretation. But yeah that is possible, but I never tried it, for that I'd assume all you would have to do is change the element the grade is in to be a input. You can try that out and see what you like more.

from pupilpathplus.

 avatar commented on July 18, 2024

ok, but i have a question. If you make an inspect elemnt change, how would you save it, so that everytime you open that certain website it runs automatically just like it would with tampermonkey.

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

I don't think something like that is possible, I may be wrong, but google it just to make sure.

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

So for what you want all you would have to do is add a event listener to the element the grade is in, and make it open the grade changer popup. No need for inspect element.

from pupilpathplus.

 avatar commented on July 18, 2024

Yeah but everytime i try to do that, it either gives me to many Ids, or says undefined. And By the way, I started a public gist. Its basically your code and me trying to add stuff to it.

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

Yes you should get back a bunch of id's, each one represents a grade for each class. I recommend you use querySelectorAll to get all the elements with a grade in it, then loop over them with forEach, and add an event listener to each element to open the grade changer popup.

from pupilpathplus.

 avatar commented on July 18, 2024

ok, i will see if i can do that and i will tell u

from pupilpathplus.

 avatar commented on July 18, 2024

what if you cant find an id for something. For example it says : for a certain thing. It doesn't say 100, which is the etxt im trying to edit.

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

If there is no class or ID, then you will have to select it from child nodes or parent nodes. You should learn more about the DOM, this entire userscript relies on modifying the DOM so you need to have an understanding on how to select elements, change elements, add/remove elements, and updating elements. If you have any questions google them, stackoverflow is a godsend and should have an answer to all your questions. When I made this userscript I had little to no understanding of javascript and stackoverflow was all I needed to make this userscript.

from pupilpathplus.

 avatar commented on July 18, 2024

ok thank you,!

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

There is no "h" tag in HTML, so I assume you meant a header tag such as "h1". To edit what's between the tag you first have to select it by using querySelector, getElementById, or any other selector method. Then depending on what you want to change you can use innerText to change the text or innerHtml to change the HTML.

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

KaBankz avatar KaBankz commented on July 18, 2024

The issue with the code only working in the console is probably because you are trying to run code that modifies DOM elements that have not yet been rendered. It works in the console because the page has finished rendering when you run the code, but for userscripts you have to specify the run time or it will try to run code before the page has finished loading. Here is a reference to help you understand it better: https://www.tampermonkey.net/documentation.php#_run_at For your case you should use:

// @run-at    document-end

When you do this:

document.getElementsByTagName("p")[3].innerHTML="Class Status: <span id=standing style.color= #AA9901><img src=/img/ico/tick.png> 82.09 - Borderline</span>";

You are selecting all the p tags, then using an index (3 in this case) to select a single one. This is not what you should do. That will select all p tags even ones that do not contain grades. I recommend that you find an element that wraps all the grade elements. In my original code, I have this:

document.querySelectorAll("table#progress-card > tbody > tr > td > span");

This code selects only grades because I selected the span element that contained all the grades elements. With this, you can just loop through the grades like so :

const gradeParent = document.querySelectorAll('table#progress-card > tbody > tr > td > span');
gradeParent.forEach(e => {
  const originalGrade = parseFloat(e.innerText);
  const className = e.parentElement.parentElement.parentElement.childNodes[1].innerText.toUpperCase();
  console.log(`${className} = ${originalGrade}`);
  switch (className) {
    case 'ELA':
      e.innerHTML = `Class Status: <span id="standing" style="color:#AA9901";><img src="/img/ico/tick.png" /> 82.09 - Borderline</span>`;
      break;
    case 'MATH':
      e.innerHTML = `Class Status: <span id="standing" style="color:#AA9901";><img src="/img/ico/star.png" /> 90 - Passing</span>`;
      break;
  }
  // Whatever else you need...
});

But as you mentioned before PupilPath changed their website, so these selectors might not work, you will have to modify it to fit your use case. If you have trouble using selectors, then you should do some google searches, I personally learned how to use selectors by watching videos on youtube on web scraping.

from pupilpathplus.

 avatar commented on July 18, 2024

from pupilpathplus.

Related Issues (2)

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.