You are reading a single comment by @Tijs and its replies. Click here to read the full conversation.
  • Okay, I posted above about a bookmarklet for reposting Instagram stuff onto the forum. It turns out I don't know anything about javascript and I can't be arsed to learn it.

    Here's how far I've got based on copy/pasting shit from Stack Overflow:

    javascript:function(){
        // to do... 
        var imgURL = document.querySelector('img.something').src;
        
        // Create new element
        var el = document.createElement('textarea');
        // Set value (string to be copied)
        el.value = "![]("+imgURL+")";
        // Set non-editable to avoid focus and move outside of view
        el.setAttribute('readonly', '');
        el.style = {position: 'absolute', left: '-9999px'};
        document.body.appendChild(el);
        // Select text inside element
        el.select();
        // Copy text to clipboard
        document.execCommand('copy');
        // Remove temporary element
        document.body.removeChild(el);
    }
    

    I am stuck now. I don't know how/where to find the Instagram image URL.

    There is an extension that does something similar here:

    https://github.com/odditive/instagram-image-url/blob/master/src/extension/content.js

    However that just takes whatever you right click and uses that as the image URL through this:

        clickedEl = event.target.parentElement.childNodes[0].childNodes[0];
        ....
        url = clickedEl.src;
    

    I could just add another context menu element thing to that extension, but then I have to learn how to write/add a Chrome extension and that's a pain in the arse.

    Surely it's like a 5 minute job to get this working for someone who knows Javascript?

    All my work is Fortran/Python, I'm got no idea with this sort of stuff

  • I don't know how/where to find the Instagram image URL.

    Add /media/?size=l to the end, and hit return.

    Remove the 'taken by' part of the url, when it's there.

  • Well, I'm already using the extension I mentioned above, which makes the whole thing quite easy:

    https://chrome.google.com/webstore/detail/getthatpic/fkdmnfbeaepmildaolaoicjbfkghpcco?hl=en

    however it'd still be nice to have as a bookmarklet that works on mobile etc., and it'd save the 1-2 seconds it takes to type ![]() every time, works for people who don't like installing random extensions, etc.

    And you could have it format the image into a link as well through the horrible [![](img)](link) format.

    Edit: ooooh hang on, are you saying that that would work to get the image URL in the bookmarklet? Nice. Does it work with albums though?

About

Avatar for Tijs @Tijs started