In my last long scroll post I went over the steps for forking and editing a silly GitHub page to mess with the lyrics of “Home on the Range.” That is like, so, not really useful.

This one might not be either. But it could be fun.

When you use a bookmarklet tool created with my Flickr CC Attribution Helper, there are a series of random messages that cycle through while the browser waits for the flickr API to return the data it needs.

Here is a crude approximation as a 4 frame animated GIF:

cc--attribution-helper

I wanted something to animate while this communication happened so you know that the thing is in process, so it was learning how to use the Javascript setInterval() and SetTimeout() functions. It can also generate a pop up if a longer than expected period passes (sometimes the flickr API chokes).

ANYHOW, I got the idea from… was it Slack’s loading messages that inspired me?

Last week Brian Bennett noticed!

That’s true- I think once after Ken Bauer said something nice about the Flickr CC Attribution Helper I slipped a “Waving at Ken” into the array of messages.

I was ready to offer to add any message Brian wanted into the mix.. and then saw the light bulb go off

Why should I change the code when anyone else can via a GitHub pull request?

So I went in to motion to write this up… and paused. I saw some un-necessary redundancy in my code.

You see, each “flavor” of the tool (that means the kind of attribution it generates, a WordPress One with caption tags, even one in Markdown) exists as an HTML file that is passed the flickr ID of the photo of interest, and has in it the Javascript code to spawn the attribution window.

I had the same code repeated in each, so I did some consolidation to put common used JavaScript, including the array for the funnymessages array, into a single Javascript file.

That’s a long way to say here is the file you need to fork and edit if you want to add a new message. You just need to put a quoted string into the funnymessages array, putting it and a comma after the last element.

Here is how the function that does the work looks now:

I could fork/edit this to add a message for maybe Brian, see the last element in the funnymessages array:

And once I merge the request, that message may surprise Brian the next time he fetches a flickr attribution with his bookmarklet. I can change how it works without changing his tool at all.

And you can do this too.

All ya gotta do is fork.

I triple dog dare ya. Here’s the keys.

triple-dog


Top / Featured Image credit: I ran out of inspiration for a metaphor, so I am just using a screenshot of one of the random messages that flash when you use the Flickr CC Attribution Helper.

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Comments

  1. Hi Alan,
    So I gave this a go too.
    What was interesting is that I had already forked this repo a while back.
    Hitting the edit link on your file created a new branch on my repo. Where I made an edit and a pull request.
    This raise the question, for me, was my forked repo keeping unto date with yours? More digging to do…

    1. This is the part I remain fuzzy, another reason for the experiment here. A forked repo should not change, but when I look at it’s status it notifies you that yours is a commit “behind” mine.

      But your forked repo does not have the new file I added, that you forked and edited (/assets/javascript/cc-attributor.js) the question is where is that in your repo?

      There is some irony that the only people you have taken up my Fork Challenge are you and David Wright, and both of you are among the few that have already done this in my stuff. It’s a steep uphill to get other people to do this….

      1. It does seem a steep hill but the stuff you are doing has really helped me. I’ve dipped into git now and again but it didn’t stick. The Fork Challenges have given me some traction at, hopefully the right time. I even did the daily create on Github today:-)

Leave a Reply

Your email address will not be published. Required fields are marked *