Please excuse my sub-par JavaScript, I am a backend dev.

All you need to do is paste this into Tampermonkey and enter your username and your instance url (on two locations).

This is not showing other users’ scores and it doesn’t make your score visible to anyone else than yourself.

So no need for karma farming. This is just for fun.

// ==UserScript==
// @name         Lemmy score
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Shows your total post/comment score at the top right.
// @author       You
// @match        ENTER INSTANCE URL HERE (leave the asterisk after the URL)*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=feddit.de
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    var USERNAME = "ENTER USERNAME HERE";
    var INSTANCE_URL = "ENTER INSTANCE URL HERE";

    var totalScore = 0;
    var currentPage = 1;

    function postResult() {
        var navbar = document.getElementsByClassName("collapse navbar-collapse")[0];
        console.log(navbar);
        var ul = document.createElement("ul");
        ul.className = "navbar-nav";
        ul.id = "karma-ul";
        var li = document.createElement("li");
        li.id = "karma-li";
        li.className = "nav-item";
        li.innerHTML = '<div id="karma-div">' + totalScore + '</div>'
        navbar.appendChild(ul);
        ul.appendChild(li);
    }
    function callPage() {
        var userRequest = new XMLHttpRequest();
        userRequest.onreadystatechange = function () {
            if (this.readyState == 4) {
                if (this.status == 200 ) {
                    var res = JSON.parse(this.responseText);
                    if (res.posts.length==0 && res.comments.length==0) {
                        postResult();
                    } else {
                        totalScore += res.posts.map(x => x.counts.score).reduce((partialSum, a) => partialSum + a, 0);
                        totalScore += res.comments.map(x => x.counts.score).reduce((partialSum, a) => partialSum + a, 0);
                        currentPage++;
                        callPage();
                    }
                }
            }
        }
        userRequest.open("GET", INSTANCE_URL + "/api/v3/user?username=" + USERNAME + "&limit=50&page=" + currentPage, true);
        userRequest.send();
    }

    setTimeout(callPage, 200);
})();

      • borlax@lemmy.borlax.com
        link
        fedilink
        arrow-up
        5
        ·
        1 year ago

        Fair… My concern is people starting to engage with content here only for the promise of fake internet points.

        To each their own tho.

        • Square Singer@feddit.deOP
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          I see your point. On the other hand, my script doesn’t allow showing off these fake internet points.

          I could have made a script that edits the score into your profile, but I didn’t want to do that since it would allow showing off. And that could be problematic, because then people would do what you fear.

          But I don’t quite see why anyone would farm score just so that they themselves can see a higher number that has no actual value at all.

        • fidodo@beehaw.org
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Isn’t the actual point that other people can see your karma? That’s not a risk with this script. I mean you could go around telling people your karma but that’d be super lame.

        • Storksforlegs@beehaw.org
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          1 year ago

          I agree, I don’t think I’ll be using it. But I don’t see the harm in people wanting to keep track if they have the option. :)

    • Square Singer@feddit.deOP
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      Apparently not, since it’s two quite different things. The first one was a Python script that you can run from the console and every time you want to know the value, you need to re-run it.

      This here is a Tampermonkey script which you can just add once and it’s working all the time.

      I would have edited it into the other post, but there was some discussion on the other post that edits to posts don’t seem to work on federated instances right now. So apparently a second post was necessary.

  • lemillionsocks@beehaw.org
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    I had one back in the day got it in 09 which means I would immediately wind up with buyers remorse as t-mobile in my area was not great at the time and the motorolla droid would soon release and have just enough horsepower to do more.

    Overall though the G1 had things about it that I absolutely love and things that made it objectively not great. 2nd gen androids would be a lot more usable.

    The good:

    The form factor was great. Pocketable, the keyboard was a good size for your hands, and although it looks like cheap gray/black plastic the material was actually fairly soft and nice to the touch. The device was also an absolute tank. I dropped my g1 so many times and like big drops on concrete and rolling down stairs bad. It still works! The keyboard was a joy to type on and I could walk around while not looking at my phone and type away to finish a chat, and the little track ball nubbin was possibly the greatest loss to history. It was so smooth and precise and satisfying to use.

    You could get an extended battery and it would last all day. The rom support was also EXCELLENT since this was the first android and although everyone running anything higher than 1.6 was lying to themselves about how usable and fast it was, the fact that it got as many releases after being abandoned was amazing. Android was also so new and green that the roms were exciting and offered quite a bit on top of the vanilla experience. Things like using a swap partition on an sdcard or installing apps directly to a linux formatted partition on your sdcard to deal with the limited space. It was so cool.

    The Bad:

    While I have nothing but praise for the casing and it’s form factor, the hardware was not up to snuff for android. The resolution of the small screen was too low and it was only single touch. You couldnt even pinch zoom which is why android still has that double tap one finger zoom option. The cpu and ram were NOT up to snuff at all for the hardware and the g1 became so dated so quickly that despite being the original it could NOT handle android 2.0 and beyond. Which means a little over a year into it’s launch the first android device lost official software support.

    The OS was also so forward thinking while also lacking some super important features. You had true unfettered access and background usage and there was no way to actually close programs if they didnt have “close” option in app. You needed a third party task killer. Not auto killer mind you but something that let you pull up what was running and close misbehaving programs or ones that just didnt have an close button. Ram was already tight on this device, and cpu limited but unfettered background apps could grind this phone to a hault. The upside to this is that using a third party rom with swap partition gave me better multitasking than any android phone I had since until I got a device with more than 6 gigs of ram. (Even then my g1 could run multiple browsers in different windows without them closing each other) .

    The camera was awful. Like genuinely bad and even a slight shadow would cause your camera to be a noisy mess. It also didnt have a front facing camera so no selfies or video chatting.

    The battery life was also bad. Easily fixed with a 3rd party replacement but it did turn your phone into a little brick and the back case that came with those batteries was always worse than original.

    Oh also headphone jack fans should note this phone required a headphone to miniusb adapter.

    Overall since I got a new phone I’ve always said if they would release a true g2 with same form factor and good hardware I would drop money on it in a heartbeat. Maybe make the screen slightly bigger. Other than that the phone was a flawed little thing. It was my first smartphone though and I absolutely loved using it.