Archive for the ‘Scripting’ Category
Posted by jpluimers on 2023/07/20
Maintaining a blog takes considerable time, so I wrote a bit of JavaScript for the browser console and bookmarklets to help me navigate faster, especially from my published posts on wiert.me back to the WordPress editing environment.
I wrote this because a query like [Wayback/Archive] wordpress get id from post html – Google Search top hits only contain results that work within the WordPress environment itself, like for instance [Wayback/Archive] 14 Ways to Get Post ID in WordPress.
This blog post is long and contains a lot of information, so I have split it in quite a few sections.
Let’s get started:
Read the rest of this entry »
Posted in Bookmarklet, Classic editor, Development, Gutenberg editor, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Browsers, Web Development | Leave a Comment »
Posted by jpluimers on 2023/07/12
Given my health uncertainty, I am looking for maintainers for the fritzcap project (it captures calls from a Fritz!Box modem/router and is written in Python).
History
The fritzcap project was originally started in2007 by [Wayback/Archive] spongebob | IP Phone Forum, first as a binary fritzcap.exe Windows executable (see his first post at [Wayback/Archive] FritzBox: Tool für Etherreal Trace und Audiodaten-Extraktion | IP Phone Forum). In 2010 it became an open source Python project at [Wayback/Archive] Google Code Archive – Long-term storage for Google Code Project Hosting.
Read the rest of this entry »
Posted in About, Audio, Cloud, Communications Development, Containers, Development, Docker, ffmpeg, Fritz!, Fritz!Box, fritzcap, Hardware, HTTP, Infrastructure, Internet protocol suite, Media, Network-and-equipment, Personal, Power User, Python, Scripting, Software Development, TCP | Leave a Comment »
Posted by jpluimers on 2023/07/11
TL;DR:
pidof python | tr " " "\n" | xargs -r -n 1 lsof -i -a -e /run/user/1001/gvfs -p
Breakdown:
Via:
–jeroen
Posted in *nix, *nix-tools, bash, bash, Development, lsof, Power User, Scripting, Software Development, xargs | Leave a Comment »
Posted by jpluimers on 2023/07/02
I quickly hacked together this JavaScript Bookmarklet today, so it is without any checks and assumes you have enabled one Mastodon account for publishing, that you are hosting your blog on WordPress.com, and using the Classic Editor:
javascript:(function(){
publicizeFormEditHref = document.getElementById('publicize-form-edit');
publicizeFormEditHref.click();
mastodonCheckboxes = document.getElementsByClassName('wpas-submit-mastodon');
mastodonCheckboxes[0].checked = true;
publicizeFormHideHref = document.getElementById('publicize-form-hide');
publicizeFormHideHref.click();
updateButtonHref = document.getElementById('publish');
updateButtonHref.click();
})();
The above code is the state of [Wayback/Archive] JavaScript Bookmarklet for the WordPress classic editor which enables mastodon publishing (assuming you have one mastodon publishing account enabled … ) and due to be improved in a later blog post.
This will enable the currently edited post to be published to Mastodon, then update/publish the post.
On enabling one Mastodon account for publishing:
Read the rest of this entry »
Posted in Bookmarklet, Development, HTML, JavaScript/ECMAScript, Mastodon, Power User, Scripting, SocialMedia, Software Development, Twitter, Web Browsers, Web Development, WordPress, WordPress | Leave a Comment »
Posted by jpluimers on 2023/06/14
Based on [Wayback/Archive] javascript – how to refresh an iframe automatically – Stack Overflow and help from [Archive] Roderick Gadellaa (@RGadellaa) / Twitter, I used this JavaScript code right after the body in the html page to reload part of the iframes every 3 minutes and another part every 3 hours:
<script>
var iframes3minuteInterval = setInterval( () => {
const ids3minutes = [ 'agenda_iframe', 'month_iframe' ];
ids3minutes.forEach( id => {
element = document.getElementById( id );
element.src = element.src;
});
}, 1000 * 60 * 3);
var iframes3hourInterval = setInterval( () => {
const ids3hours = [ 'weerplaza_nederland_iframe', 'weerplaza_radar_iframe', 'buienradar_iframe' ];
ids3hours.forEach( id => {
element = document.getElementById( id );
element.src = element.src;
});
}, 1000 * 60 * 60 * 3);
</script>
The iframes are widgets for:
This was to workaround GitLab pages on a custom domain are nice, but be aware of intermittent 502 and certificate errors. Now the page only gets loaded once, and the widgets at intervals that are needed.
—jeroen
Posted in CSS, Development, HTML, JavaScript/ECMAScript, Scripting, Software Development, Web Development | Leave a Comment »
Posted by jpluimers on 2023/06/08
In Bookmarklets for Archive.is and the WayBack Machine to go to the original page, I wrote about how the Shadow DOM is used to prevent side effects between the code of the WayBack machine and the archived page.
In a similar manner, Bookmarklets can also interfere with code on the page and vice versa, for instance by using global variables.
That is why the [Wayback/Archive] A simple bookmarklet to tweet the current page – DEV Community is wrapped in a special kind of function:
javascript:(function(){
n=getSelection().anchorNode;
t=n.nodeType===3?n.data:n.innerText;t='“'+t+'”\\n\\n';
window.open(`https://twitter.com/intent/tweet?
text=${encodeURIComponent(t)}${document.location.href}`)
})()
This is an [Wayback/Archive] IIFE – MDN Web Docs Glossary: Definitions of Web-related terms | MDN or “Immediately Invoked Function Expression”, a mechanism coined by [Archive] Ben Alman (@cowboy) / Twitter at [Wayback/Archive] Ben Alman » Immediately-Invoked Function Expression (IIFE).
Since the variables are inside the function body, they won’t interfere with the page. The body will be immediately executed.
Related:
–jeroen
Posted in Bookmarklet, Development, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Browsers | Leave a Comment »
Posted by jpluimers on 2023/06/07
Quite often, when browsing an archived page on Archive.is or the WayBack Machine, I want to check the current status of the original page.
So I wrote a few Bookmarklets.
Archive.is
Default field
Any Archive.is page has a Saved from field which is an input html element having a name attribute with value q and a value property containing the URL, which is navigated to by assigning the location in the above code.
So my goto Bookmarklet is this one:
javascript:open(document.getElementsByName("q")[0]?.value)
It uses [0]? as there is no getElementsByName, but there is [Wayback/Archive] Document.getElementsByName() – Web APIs | MDN as name values need not to be unique but id values have to be.
Other Archive.is fields
The above works on all types of Archive.is page types:
- search pages like https://archive.is/https://example.org
- actual archived pages like https://archive.is/LkpeZ and https://archive.ph/2022.01.22-165646/https://wiert.wordpress.com/
- these only have a
Saved from field.
- redirected archived pages like https://archive.ph/UEQeg and https://archive.ph/2013.01.03-111457/http://www.iana.org/domains/example/
- these both have
Saved from and Redirected from fields.
- complex pages like https://archive.ph/5iVVH and https://archive.ph/2015.11.14-044109/http://www.example.org/
- those have even more fields: in addition to fields
Saved from and Redirected from, the fields Via and Original also are added.
To get the additional fields from the other fields, we need to figure out a way to access them.
Read the rest of this entry »
Posted in Bookmarklet, Development, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Browsers | 1 Comment »
Posted by jpluimers on 2023/06/01
As Chrome mangles Bookmarklets to a partially escaped form (I think using Percent encoding), I first tried to document my Bookmarklets in Markdown so I could easier edit them and copy these JavaScript links to various browsers. That failed, because the html rendered from the Markdown didn’t contain the links any more. So I now use plain html for documenting them which is a pain to edit but works.
[Wayback/Archive] Some bookmarklets hosted as [Wayback/Archive] Some bookmarklets – cached 1 minute – throttled and [Wayback/Archive] Some bookmarklets – cached 1 year – CDN.
This is why:
- Technically you can include JavaScript for Bookmarklets in Markdown documents both as Markdown links (either with escapes or by splitting reference and link in two pieces) and html links (as embedding html in Markdown is allowed): [Wayback/Archive] Bookmarklet link in Markdown document – Stack Overflow (thanks [Wayback/Archive] Adam Haile, [Wayback/Archive] Zombo and [Wayback/Archive] stevemegson)
- Because of security reasons, many hosters will filter out JavaScript when transforming Markdown in html [Wayback/Archive] Embed JavaScript in GitHub README.md – Stack Overflow (thanks [Wayback/Archive] Matt Smith and [Wayback/Archive] coyotte508)
Searches: [Wayback/Archive] markdown javascript in link – Google Search and [Wayback/Archive] “embed javascript” in markdown – Google Search.
–jeroen
Posted in Bookmarklet, Development, JavaScript/ECMAScript, Power User, Scripting, Software Development, Web Browsers | Leave a Comment »