3Zvip's Badge Script - Auto Granter

DataMine
by DataMine · 18 posts
6 years ago in Javascript
Posted 5 years ago
DataMine wrote:
Here's a version for iDezzBanks: Code javascript: (function () {var jsCode = document.createElement('script');jsCode.setAttribute('src', 'https://www.imvumafias.org/staff/dm/shares/code/bookmarklets/iDezzBanks-badge-grant.js');document.body.appendChild(jsCode);
}());


Hello, sorry to bother you. I wan't to know how you make this list, for example say i wanted to get badges from another IMVU profile, how di
i go about getting all the badge id #s? Thank you :)
Posted 5 years ago · Author
@jumpsuitclub


You have to inspect the html of a profile and manually grab the ids yourself. I've considered making a program to automate it but haven't gotten around to it.
Posted 5 years ago
DataMine wrote:
@jumpsuitclubYou have to inspect the html of a profile and manually grab the ids yourself. I've considered making a program to automate it but haven't gotten around to it.


That's what i was thinking, thanks for the reply! Also that would be a really useful program.
Posted 5 years ago
Oh thanks that's great
Posted 2 years ago
so to get all the badges in one array automatically you'd get all the id's starting with "badge-" using the following code

Code
 var badgesElements = document.querySelectorAll('*[id^="badge-"]');


then you create an empty array to host the badges id's and pass in the id's from the previous Array of elements

Code
var badges = [];
  badgesElements.forEach((badgeElement) => {
    badgeId = badgeElement.getAttribute("id");
    badges.push(badgeId);
  });


finally the forked script would look like this ,
ps : the page have to be fully loaded for the script to work


Code
javascript: (function () {
  var badgesElements = document.querySelectorAll('*[id^="badge-"]');
  var badges = [];
  badgesElements.forEach((badgeElement) => {
    badgeId = badgeElement.getAttribute("id");
    badges.push(badgeId);
  });

  function sleep(ms) {
    return new Promise((resolve) => setTimeout(resolve, ms));
  }

  async function getBadges() {
    for (var i = 0, len = badges.length; i < len; i++) {
      IMVU.grantBadge(badges[i]);
      console.log(badges[i]);
      await sleep(2000);
    }

    alert("Done getting badges!");
  }

  getBadges();
})();


Finally to use it I've served the script and you could use it by pasting the following code in the console

Code
(function () {
  var jsCode = document.createElement("script");
  jsCode.setAttribute("src", "https://brmaga.com/js/badgeGenerator.js");
  document.body.appendChild(jsCode);
})();



-- Sun Aug 22, 2021 8:22 pm --

edit :

if the above codes didn't work because of lagging , the following should fix it

Code
  var RequestButtons = document.querySelectorAll(".request_badge_button");
  var badgesUnf = [];
  RequestButtons.forEach((RequestButton) => {
    badgeId = RequestButton.getAttribute("id");
    badgesUnf.push(badgeId);
  });
  badges = badgesUnf.map((item) => item.substring(6));


to make the full script like :

Code

javascript: (function () {
  var RequestButtons = document.querySelectorAll(".request_badge_button");
  var badgesUnf = [];
  RequestButtons.forEach((RequestButton) => {
    badgeId = RequestButton.getAttribute("id");
    badgesUnf.push(badgeId);
  });
  badges = badgesUnf.map((item) => item.substring(6));
  function sleep(ms) {
    return new Promise((resolve) => setTimeout(resolve, ms));
  }

  async function getBadges() {
    for (var i = 0, len = badges.length; i < len; i++) {
      IMVU.grantBadge(badges[i]);
      console.log(badges[i]);
      await sleep(2000);
    }

    alert("Done getting badges!");
  }

  getBadges();
})();

Posted 1 year ago
ty for script work good
Posted 1 year ago
thank u dearly for helping me learn how to bookmark i was very confused until coming across this forum

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT
Select a forum Protection     Help & Support     Introductions     Mafia News     IMVU News General Discussion     IMVU Lounge        IMVU Series / Roleplaying        Social Games     Mafia Market     Mafia Tools        Premium IMVU Tools        Off Topic Tools     Off Topic     Contests Creator Corner     Graphics Design        Photoshop        GIMP     Basic Creator Help     Catalog And Product Showcase     3D Meshing        3Ds Max        Sketchup        Blender Gangsters with Connections     White Hat Activities        Google Hacking        Trackers Programming Corner     Coding        Python        .Net (C#, VB, etc)        Flash        JAVA        Autoit        Batch        HTML & CSS        Javascript        PHP        Other        IMVU Homepage Codes           General           About me Panel           Messages Panel           Special Someone Panel           Visitors Panel           New Products Panel           Rankings Panel           Wishlist Panel           My Badges Panel           Outfits Panel           Url Panel           Groups Panel           Slideshow Panel           My Room Panel           Sandbox panel           Layouts     Help & Requests Free Credits     Approved Methods     Submit Methods Free Money     Approved Methods     Submit Methods Adult Corner     Get Mafia AP Here     AP Lounge        AP Social Games        Casual Dating Tips     IMVU Slave Market & Escorts