Skip to content

Commit

Permalink
Fixed problem with "moreActivity" page
Browse files Browse the repository at this point in the history
As object, the moreActivity code has been remade and fixed, should now be working properly
  • Loading branch information
Code-Dani committed Jan 4, 2023
1 parent 234ffab commit abc2bd9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
23 changes: 18 additions & 5 deletions javascript/mainPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
window.onload = function(){
/*
const edgeAD = "ITIT_SapphireAppInstall_Announcement_amc_Default";
const mStoreReminder = "ITIT_Lifecycle-Shop and Earn reminder";
const setObjective = "ITIT_Lifecycle-Set a goal";
const welcomeBonus = "ITIT_Lifecycle-Onboarding";
const setAGoal = "ITIT_Lifecycle-Just set a goal";
*/
//Guessing that ITIT stands for my nationality (Italy), so i'm removing it from moreActivityCode const
const moreActivitiesCode = "moreactivities_offer";

//Creating custom button for the extension
var menuContainer = document.getElementsByClassName('c-pivot pull-left')[0]; //grabbed column div for the play button
Expand All @@ -13,11 +22,10 @@ window.onload = function(){
menuContainer.innerHTML += playItem;
menuContainer.innerHTML += doSearches;


//Adding onclick event to the custom button
document.getElementById("reward_pivot_collect").onclick = (function (){
if(document.getElementsByClassName('m-card-group')[0].getElementsByClassName('ng-scope ng-isolate-scope c-card ').length == 3){
console.log("Entered IF");
console.log("dailyActivities: ENTERED DAILY ACTIVITIES");
//enters if the 3 daily challenges are loaded
document.getElementsByClassName('m-card-group')[0].getElementsByClassName('ng-scope ng-isolate-scope c-card ')[0].getElementsByTagName('a')[0].click();
document.getElementsByClassName('m-card-group')[0].getElementsByClassName('ng-scope ng-isolate-scope c-card ')[1].getElementsByTagName('a')[0].click();
Expand All @@ -28,15 +36,20 @@ window.onload = function(){
const container = document.getElementById("more-activities").children[0];
//check if "other activities" tab has anything in it (basically if it exists)
if(container.childElementCount > 0){
console.log("moreActivities: ENTERED MORE ACTIVITIES");
const numberOfItems = container.childElementCount; //usually 12
console.log("moreActivities: NUMBER OF ITEMS="+numberOfItems);
for(var i=0; i<numberOfItems;i++){ //cycle through all items
//make it so that it doesn't click the mobile app AD && if its already been collected (by checking if it has the typical green icon on the top-right corner)
if(!(container.children[i].hasAttribute("ng-class")) && container.children[i].getElementsByClassName("mee-icon mee-icon-SkypeCircleCheck").length == 0){
var id = container.children[i].getElementsByClassName("text-align-center rewards-card-container")[0].getAttribute("data-bi-id")
if(id.includes(moreActivitiesCode) && (container.children[i].getElementsByClassName("mee-icon mee-icon-SkypeCircleCheck").length == 0)){
//It means that its a bonus activity that can be done, otherwise its just an AD
console.log("moreActivities: OPENING NUMBER="+i);
container.children[i].children[0].children[0].children[0].children[0].children[0].click(); //clicks the item
}

}
}

});

//Adding onclick event to the custom button
Expand Down
8 changes: 4 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"js": ["javascript/mainPage.js"]
},
{
"matches":["https://www.bing.com/*form=ML28X*","https://www.bing.com/*form=ML28Y*","https://www.bing.com/*form=ML28ZK*","https://www.bing.com/*form=ML28ZT*","https://www.bing.com/*form=ML28*","https://www.bing.com/*form=ML29*"],
"matches":["https://www.bing.com/*form=ML28*","https://www.bing.com/*form=ML29*","https://www.msn.com/*form=ML29*"],
"js": ["javascript/focusPage/instaClose.js"]
},
{
"matches":["https://www.bing.com/*form=ML17QA*","https://www.bing.com/*form=ML17QB*"],
{
"matches":["https://www.bing.com/*form=ML17*"],
"js":["javascript/focusPage/survey.js"]
},
{
"matches":["https://www.bing.com/*FORM=ML12JG*","https://www.bing.com/*form=ML12JG*","https://www.bing.com/*form=ML151V*","https://www.bing.com/*FORM=ML151V*"],
"matches":["https://www.bing.com/*form=ML12*","https://www.bing.com/*form=ML15*"],
"js":["javascript/focusPage/quiz.js"]
},
{
Expand Down

0 comments on commit abc2bd9

Please sign in to comment.