Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)CR
Posts
59
Comments
249
Joined
2 yr. ago

  • Thanks for the testing! I'm happy it works :D.

    I think I only tried to execute the UPDTE directly from the batch file instead of doing it from python. Good idea!

    Only annoying thing is that Firefox needs to be closed while updating.

    I don't remember if I tried that. It kinda makes sense... I don't think it's expected to hot edit those links :P.

  • Accessing the places database directly would be great of course

    The problem is not accessing the DB (I manage to make that work, see the previous link). I was even able to execute the UPDATE... but there is a hash to prevent unwanted modifications. I found some python code that should calculate the hash, but Firefox did not like it... or I missed some detail (encoding maybe?). Personally, the workflow I achieved with that script is good-enough for me, but it's far from ideal.

    The other usual approach to scripting in the browser is ViolentMonkey (or TamperMonkey, or others), much better for big scripts. The downside is that (AFAIK) you need to inject in every page all the scripts you want to be able to execute and (again, AFAIK) there is no way to run them as easy as "Control+L" (focus navbar) > Type keyword... which I have now so ingrained in my brain :D.

  • _ Thanks for the kind words. I Like meeting nice people here.

    shame that user tags aren't a feature yet so i notice when i run into you

    It's a bit cumbersome to use extensively, but this works for me in the default UI (with a Stylus-alike add on):

     
            a[href="/u/username"] {
          background: red;
          color: white !important;
        }
    
    
      

    For mlmym you need to change a[href="/u/username"] with a[href="/lemm.ee/u/username"].

    i wish i could move to mlmym, but it's just not as featureful as either lemmy-ui or reddit+res

    Yeah, lemmy is very work-in-progress. I'm also eager for it to be more mature. But as I'm not actively helping with the coding, I can't complain :).

    And, sadly, mlmym deveopment is a bit slow right now. I hope it's because summer holidays and such. But if it doesn't catch up in the near future, I will have to move to other options. That's why I'm not investing too much time right now in my toolchain. I still don't know what to commit to.

  • (... continues from previous comment, I was getting an error when I tried to post all in the same comment)

    post image to reddit

    I don't recommend this one, I haven't used in a while and it doesn't work great with most sites.

    It should works very similar to the previous one, but looking for images on the page. It also writes my usual "Source: titleurl blablabla" comment for the most common sites.

    The result is a huge mess and very fragile. I post it more as an example of how you could do some things.

    (one-liner missing because I'm still getting an error)

    EDIT: Yeah, lemmy doesn't like a single line with >5000 characters, hehe. Anyway, I don't recommend using this last one.

  • the communities' ids are in the url, so the reddit method doesn't work unless i memorise the id №.

    Yeah... that's why I didn't tried that yet. I'm waiting a bit to see what frontend options are.

    The good news is that mlmym uses the community name for posting and searches:

    To make it work with community ids, I planned to have something like the "subreddit shorcuts" from the "post to reddit" bookmarklet (see below). Not ideal, but better than nothing.

    i don't suppose you could share some of those?

    Sure, here there are. I realized that a couple of them are not really bookmarklets, but simple bookmarks with the %s param. You need to add a keyword and use it with keyword string to be searched.

    lemmy all search

    https://lemm.ee/search?q=%s&type=All&listingType=All&page=1&sort=TopAll

    lemmy community search

    https://lemm.ee/search?q=%s&type=Communities&listingType=All&page=1&sort=TopAll

    get link in markdown

    Execute it without param (e.g.: link) to get [title](url)
    Execute it with a param (link text to display) to get [text to display](url)
    It will show the result in a prompt and you can copy from there. The prompt itself has no effect, it doesn't matter how you close it.

    One liner:

     
            javascript:(function() {var title = ("%s" || document.title).replace("[", "\\[").replace("]", "\\]");prompt("Title:", `[${title}](${document.location.href})`);})()
    
    
      

    I also have one to get just the title of a page, but I leave that as an exercise to the reader :D. It's very easy to modify the link one.

    post to reddit

    Use it with the subreddit name (e.g.: post CassetteFuturism) or the subreddit shortcut (e.g.: post cf).
    If executed with no param, it will show a list of "shortcuts" and will ask you to select one.

    The shortcuts are in the `subKeys``dictionary. That's the trick that could be used to assign the community ids from the community names (or custom shortcuts). Not practical for a random commmunity, but manageable for the most common ones.

    One liner:

     
            javascript:(function() {var subKeys = {cf: 'CassetteFuturism',it: 'ImaginaryTechnology',iv: 'ImaginaryVehicles',ap: 'ApocalypsePorn',ss: 'Simon_Stalenhag',sw: 'spainwave',sk: 'sketches',};var subreddit = '%s';if (!subreddit) {var promptText = "Type subreddit:";for (var shortcut in subKeys) promptText += `\n- ${shortcut}: ${subKeys[shortcut]}`;subreddit = prompt(promptText);}if (!subreddit) return;if (subKeys[subreddit]) subreddit = subKeys[subreddit];var title = document.title;var url = encodeURIComponent(document.location.href);window.open(`https://www.reddit.com/r/${subreddit}/submit?url=${url}&title=${title}`);})()
    
    
      

    (...continues on next comment?)

  • An extension that does this with over 30 image search engines is Search By Image, a Mozilla recommended extension

    I don't know how I missed that until now, thanks!! I will try it right now.

    I also use ImgOps.com

    Yeah, that's what I was using for a while and what motivated me to write the bookmarklet to avoid going through it every time.

    Regarding the different searches, I found that they cover very different needs:

    • TinEye: usually the best when you want (almost) exact matches.
    • Yandex: probably the stronger as a general search
    • Google: in my experience, the best to "understand" the image and identify the object / subject even if there are no real matches for that image
    • Bing: you sometimes get lucky with it when the others fail
    • SauceNAO: the most convenient to find the original pages for DeviantArt, ArtStation and Twitter images.
  • Not that I'm aware of. I think they are so simple that there isn't very much to say about them. They are just plain javascript that works as if you typed it on the console. Although, there a couple of tricky things.

    EDIT: I'm not saying javascript is simple. Bookmarklets can be very complex, but that's just javascript. If you know how to do it on the browser console, you just need to write it in a one-liner and it will work as a bookmark (with the caveats that I talk about later).

    For the basics, see this article: What are Bookmarklets? How to Use JavaScript to Make a Bookmarklet in Chromium and Firefox

    If you follow that post, there will be no problem. But you will have issues if you don't use the "auto-executed anonymous function" wrapper.

    And, as the post says, you need to write all semicolons and brackets to avoid funny things when removing line breaks.

    EDIT-2: I forgot to mention the %s part, I think that's not its intended use. I know it from keyworded regular-non-js bookmarks used for searches. See Using keyword searches - MozillaZine Knowledge Base. The great part is that it also works with bookmarklets :).

    The other tricky part is the inconvenience of editing them after some time if you don't have a pretty-formatted version. I've been able to hack a script to read bookmarklets from Firefox places DB, pretty-format, open in VIM and re-convert them to one-liners after the edition. I wasn't able to save them automatically to Firefox because some secure-hash stauff, so I still need to copy-paste them manuall at the end.

    See this post: Script for easy bookmarklet edition [Windows] : firefox

  • Got it, thanks for the patience :)

    It makes the job easier than reverse searching image with Yandex (which is the best method I use).

    Regarding reverse image search, this is the bookmarklet I use to lauch 5 different searches at once. On firefox you can set a keyword so I just type rev on the navbar on a tab with an image.

    If the page has more than 1 images, it tries to print a number on each one so you can specify which one you want to search... but that feature doesn't work very well. Removing that, the script would be much more simpler.

     

    One-liner:

     
            javascript:(function() {var url;var args = '%s';var imgs = document.getElementsByTagName("img");var imgIdx = undefined;if (imgs.length == 0) return;if (imgs.length > 1) {if (args.length > 1) imgIdx = parseInt(args[1]);if (imgIdx === undefined || isNaN(imgIdx) || imgIdx < 1 || imgIdx > imgs.length) {numberImgs();imgIdx = parseInt(prompt(`There are ${imgs.length} images, select index:`, 1));}if (isNaN(imgIdx) || imgIdx < 1 || imgIdx > imgs.length) return;url = imgs[imgIdx - 1].src;} else {url = imgs[0].src;}if (!url) return;url = encodeURIComponent(url);window.open("https://saucenao.com/search.php?url=" + url);window.open("https://lens.google.com/uploadbyurl?url=" + url);window.open("https://www.bing.com/images/searchbyimage?cbir=sbi&imgurl=" + url);window.open("https://www.tineye.com/search?url=" + url);window.open("https://yandex.com/images/search?rpt=imageview&url=" + url);function numberImgs() {var imgs = document.getElementsByTagName("img");for (var img = 0; img < imgs.length; img++) {var parent = imgs[img].parentElement;if (!parent) continue;var numberDiv = document.createElement("div");numberDiv.innerHTML = 1 + img;numberDiv.className = "tmpImgNumberDiv";numberDiv.style.position = "absolute";numberDiv.style.padding = "2px 9px 2px 6px";numberDiv.style.background = "#f00";numberDiv.style.color = "#fff";numberDiv.style.zIndex = "9999";numberDiv.style.lineHeight = "normal";parent.prepend(numberDiv);}setTimeout(function() {var imgNumbers = document.getElementsByClassName("tmpImgNumberDiv");var idx = imgNumbers.length - 1;while (idx >= 0) {imgNumbers[idx].remove();idx--;}}, 5000);}})();
    
    
      

    The 5 searches it launches are (replacing XXXX with the image URL):