Some JavaScript bookmarklets for WordPress published pages centered around navigation and IDs
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:
About post IDs
A post can be published with multiple ways, for instance the post with ID=85080 and title=Philosophy of management has at least these URLs:
- https://wiert.me/2022/02/14/
philosophy-of-management/ - https://wiert.me/2022/02/14/
85080/ - https://wiert.me/?p=
85080/ - https://wiert.me/
philosophy-of-management/ - https://wiert.wordpress.com/2022/02/14/
philosophy-of-management/ - https://wiert.wordpress.com/2022/02/14/
85080/ - https://wiert.wordpress.com/?p=
85080/ - https://wiert.wordpress.com/
philosophy-of-management/ - https://wp.me/pvelJ-m8g (not sure how that one is generated)
- https://wordpress.com/post/wiert.me/
85080 - https://wiert.wordpress.com/wp-admin/post.php?post=
85080&action=edit - https://wiert.wordpress.com/wp-admin/post.php?post=
85080&action=edit&classic-editor
If a custom domain is configured, then URLs number 2. through 9. will redirect to 1.
Without a custom domain, URLs 1. through 4. are invalid, and 6. through 9. will redirect to 4.
I bolded a few of the URLs, and this is why:
- The first URL is where all other URLs but the last two will redirect to.
- The fourth URL is the canonical way to refer the post within the custom domain
- The seventh URL is the canonical way to refer the post within the original domain.
It is the best way to refer to a published post by ID as that one stays unique over the lifetime of a post (a Title can change because of for instance fixing a typo, or forgetting that some characters in the title need to be URL-escaped: a thing I documented yesterday in Characters you need to escape in the Title of a WordPress post)
- The last three URLs are to edit a post.
I vastly prefer the classic editor over the Gutenberg editor, see Some of my wp-admin links, as WordPress.com is hiding access to classic-editor and wp-admin links more and more. Regrettably there is no classic editor alternative for the tenth URL above.
My goal was to get JavaScript to assemble the seventh and last URLs.
Getting information from a published post
Here are some JavaScript expressions that got me going:
| What | How | Example output |
|---|---|---|
| post ID | document.getElementsByName("comment_post_ID")[0]?.value |
85080 |
| custom domain URL | HighlanderComments.homeURL |
'https://wiert.me/' |
| original domain URL | {var a=document.createElement("a"); a.setAttribute("href", HighlanderComments.connectURL); a.pathname=''; a.search=''; a.hash=''; a.href; } |
'https://wiert.wordpress.com/' |
| original domain URL | {var a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=''; a.hash=''; a.href; } |
'https://wiert.wordpress.com/' |
| canonical URL on original domain | {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.href; } |
'https://wiert.wordpress.com/?p=85080' |
| classic editor URL | {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname='wp-admin/post.php'; a.search=`post=${postID}&action=edit&classic-editor`; a.hash=''; a.href; } |
'https://wiert.wordpress.com/wp-admin/post.php?post=85080&action=edit&classic-editor' |
| full post title (including blog title) | document.title |
'Philosophy of management « The Wiert Corner – irregular stream of stuff' |
| post title only | document.querySelector('meta[property="og:title"]')?.content |
'Philosophy of management' |
| blog title only | document.querySelector('meta[name="application-name"]')?.content |
'The Wiert Corner - irregular stream of stuff' |
| anchor HTML to canonical URL on original domain with full post title | {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.text=document.title; a; } |
<a href="https://wiert.wordpress.com/?p=85080">Philosophy of management « The Wiert Corner – irregular stream of stuff</a> |
| anchor HTML to canonical URL on original domain with full post title | {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; a; } |
<a href="https://wiert.wordpress.com/?p=85080" target="blank" rel="noopener">The Wiert Corner - irregular stream of stuff</a> |
| popup with anchor HTML to canonical URL on original domain with full post title | {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; prompt("Anchor", a.outerHTML); } |
A popup titled “wiert.me” with a prompt named “Anchor” where you can copy this HTML from:
|
Note that:
- I did not go the blind way of using regex and string concatenation that you often see: these regularly give a mess and well-tested built-in APIs are far less prone to errors
- I know
HighlanderCommentsis undocumented ([Wayback/Archive] “HighlanderComments” “WordPress” – Google Search returning no real meaningful results), but it is stable (for why: see below) - I tested these in various browsers both while logged on to a WordPress site and in an anonymous browser Windows: this code works for WordPress.com sites!
Note: for non-WordPress.com sites:
- I verified that the hidden
inputelement with IDcomment_post_IDdoes exist, so that part already works. - I need to check out the
formelement with IDcommentformto get to the edit URLs.
When there the post is not yet published, you will get a 404-page like https://wiert.me/?p=138835, but that page does contain this snippet pointing to the canonical domain:
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://wiert.wordpress.com/xmlrpc.php?rsd" />
You can obtain the value with document.querySelector('link[rel="EditURI"]').href.
Similarly this snippet is present in the page twice:
<input type="hidden" name="source" value="https://wiert.me/?p=138835"/>
You can get is through document.querySelector('input[name="source"]').value, but also via window.location.href as it is the URL of the 404-page itself.
Going the window.location route has the benefit of being able to use window.location.search to get the parameter which allows the use of [Wayback/Archive] URLSearchParams – Web APIs | MDN to get to the value of the p URL parameter.
This leads to this bit of JavaScript
searchParams = new URLSearchParams(window.location.search); searchParams.get("p");
A bookmarklet that lets me edit a post
The whole goal of writing this post is to figure a fast way to navigate from one of my own posts (for instance after finding it back through Google: the main aim of this blog is to document what I learned in the past) into editing it.
This is the Bookmarklet for it:
javascript:{ var postID = document.getElementsByName("comment_post_ID")[0]?.value; var a = document.createElement("a"); if (postID === undefined) { a.href = document.querySelector('link[rel="EditURI"]').href; var searchParams = new URLSearchParams(window.location.search); postID = searchParams.get("p");} else { a.href=HighlanderComments.connectURL; }; a.pathname='wp-admin/post.php'; a.search=`post=${postID}&action=edit&classic-editor`; a.hash=''; open(a.href); }
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:{ var postID = document.getElementsByName("comment_post_ID")[0]?.value; var a = document.createElement("a"); if (postID === undefined) { a.href = document.querySelector('link[rel="EditURI"]').href; var searchParams = new URLSearchParams(window.location.search); postID = searchParams.get("p");} else { a.href=HighlanderComments.connectURL; }; a.pathname='wp-admin/post.php'; a.search=`post=${postID}&action=edit&classic-editor`; a.hash=''; open(a.href); } |
A bookmarklet that gives the canonical post anchor
For now I will leave it at getting the canonical post anchor ID in an easy to copy way.
This is the Bookmarklet for it:
javascript:{var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; prompt("Anchor", a.outerHTML); }
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:{var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; prompt("Anchor", a.outerHTML); } |
More on HighlanderComments
Despite [Wayback/Archive] “HighlanderComments” “WordPress” – Google Search returning no real meaningful results, but [Wayback/Archive] “WordPress” “Highlander” “comments” – Google Search gives a bit more insight.
Highlander Comments is the commenting system for WordPress.com sites and, if I understand the below links correctly, is part of the JetPack under the name Jetpack Comments:
- 20110823 – [Archive/No Wayback] Highlander comments WordPress – Frontend – Web Designer Forum
Has anyone seen this yet? Its an awesome idea but apparently only for wordpress.com usersWould be awesome if .org had this or similar! - 20110812 – [Wayback/Archive] Does anybody recognize this plugin? – CMS & WordPress – SitePoint Forums | Web Development & Design Community – #1 /[Wayback/Archive] Does anybody recognize this plugin? – CMS & WordPress – SitePoint Forums | Web Development & Design Community – #2
It’s called the Highlander Comments System and is available to wp.com 4 users (i.e. people hosting their blogs on wordpress.com).
If you look at the URL of the site you provided, you can see that it is also hosted there: http://redwaspdesign.wordpress.com 33As far as this plugin being available for non wp.com 4 sites, it is discussed here: http://wordpress.org/support/topic/wordpresscom-highlander-comment-plugin 104
Basically, you can get it for a self-hosted site by installing Jetpack (http://jetpack.me/ 3).
In their own words, “Jetpack supercharges your self‑hosted WordPress site with the awesome cloud power of WordPress.com”.
The plugin is then called “Jetpack Comments” - 20110627 – [Wayback/Archive] wp.com highlander comments – plugin? | WordPress.org
I just realized, wp.com users have this new highlander comment system:anyone know of anyone who’s ported it to a plugin for non-wp.com wordpress installs? or something?i would LOVE to have this in my site.. I’m sick of the disques & facebook comments that you can’t completely stlye because of the use of<iframe>‘s and fb’s recent dropping of custom style sheets… by the looks of the source code, it seems there shouldn’t be an issue style’ing any/everything. - 20110607 – [Wayback/Archive] Post Comments Using Twitter and Facebook – WordPress.com News
Starting today, visitors to your blog can use their Facebook or Twitter account to leave comments. This saves everyone a few steps and gives visitors control over which identity they use. It’s a win for everyone.
…
As an important touch, we let you stay logged in to multiple services. This means you can stay logged in to Facebook for convenience, but still leave a comment through Twitter or your WordPress.com account. Just click whichever identity you’d like to use, and the selected one will be associated with your comment when it is published. You’re in control of your identity, as you should be.
JavaScript and URL building
This I learned from [Wayback/Archive] javascript – Get protocol, domain, and port from URL – Stack Overflow (thanks [Wayback/Archive] David Calhoun for answering and [Wayback/Archive] yelo3 for answering) via the query [Wayback/Archive] javascript get scheme and hostname from url – Google Search:
Method 1: Use the URL API (caveat: no IE11 support)
You can use the URL API (not supported by IE11, but available everywhere else).This also makes it easy to access search params. Another bonus: it can be used in a Web Worker since it doesn’t depend on the DOM.const url = new URL('http://example.com:12345/blog/foo/bar?startIndex=1&pageSize=10');Method 2 (old way): Use the browser’s built-in parser in the DOM
Use this if you need this to work on older browsers as well.// Create an anchor element (note: no need to append this element to the document) const url = document.createElement('a'); // Set href to any path url.setAttribute('href', 'http://example.com:12345/blog/foo/bar?startIndex=1&pageSize=10');That’s it!
The browser’s built-in parser has already done its job. Now you can just grab the parts you need (note that this works for both methods above):// Get any piece of the url you're interested in url.hostname; // 'example.com' url.port; // 12345 url.search; // '?startIndex=1&pageSize=10' url.pathname; // '/blog/foo/bar' url.protocol; // 'http:'
More details are below in the documentation for Document.createElement and HTMLAnchorelement (as that is what is what document.createElement("a"); returns).
Showing data that can be copied
I am still looking for a solution that pops this up in a new window or tab, but for now this method is OK for me:
- [Wayback/Archive] Window.prompt() – Web APIs | MDN
window.prompt()instructs the browser to display a dialog with an optional message prompting the user to input some text, and to wait until the user either submits the text or cancels the dialog.Under some conditions — for example, when the user switches tabs — the browser may not actually display a dialog, or may not wait for the user to submit text or to cancel the dialog.Syntax
result = window.prompt(message, default);
Note that one can prompt without window, but I am not sure why yet.
JavaScript and DOM references
Writing this blog post taught me a few new JavaScript and DOM tricks, so here are the references for that below.
Instead of HTMLAnchorelement.search, I could have used HTMLAnchorelement.searchParams (implemented by URL.searchParams) and the returning URLSearchParams instance. The code would have become slightly better readable, but a lot longer. For completeness, I have included links and abstracts to those two as well.
- [Wayback/Archive] Document.createElement() – Web APIs | MDN creates a new HTML element:
In an HTML document, the
Document.createElement()method creates the HTML element specified bytagName, or anHTMLUnknownElementiftagNameisn’t recognized. In a XUL document, it creates the specified XUL element. In other documents, it creates an element with anullnamespace URI. - [Wayback/Archive] HTMLAnchorElement – Web APIs | MDN is the HTMTL
anchor(<a>) element thatdocument.createElement("a");returns:
The
HTMLAnchorElementinterface represents hyperlink elements and provides special properties and methods (beyond those of the regularHTMLElementobject interface that they inherit from) for manipulating the layout and presentation of such elements. This interface corresponds to<a>element; not to be confused with<link>, which is represented byHTMLLinkElement) - [Wayback/Archive] HTMLAnchorElement.href – Web APIs | MDN: gets/sets the full
URL
The
HTMLAnchorElement.hrefproperty is a stringifier that returns aUSVStringcontaining the whole URL, and allows thehrefto be updated. - [Wayback/Archive] HTMLAnchorElement.pathname – Web APIs | MDN: gets/sets the URL
path
The
HTMLAnchorElement.pathnameproperty is aUSVStringcontaining an initial'/'followed by the path of the URL not including the query string or fragment (or the empty string if there is no path). - [Wayback/Archive] HTMLAnchorElement.search – Web APIs | MDN: gets/sets the URL
query
TheHTMLAnchorElement.searchproperty is a search string, also called a query string, that isUSVStringcontaining a'?'followed by the parameters of the URL.Modern browsers provideURLSearchParamsandURL.searchParamsto make it easy to parse out the parameters from the querystring. - [Wayback/Archive] HTMLAnchorElement.hash – Web APIs | MDN: gets/sets the URL
fragment
TheHTMLAnchorElement.hashproperty returns aUSVStringcontaining a'#'followed by the fragment identifier of the URL.The fragment is not percent-decoded. If the URL does not have a fragment identifier, this property contains an empty string,"". HTMLAnchorElement.textIs aDOMStringbeing a synonym for theNode.textContentproperty.- [Wayback/Archive] Node.textContent – Web APIs | MDN
The
textContentproperty of theNodeinterface represents the text content of the node and its descendants.
- [Wayback/Archive] Node.textContent – Web APIs | MDN
- [Wayback/Archive] URL.searchParams – Web APIs | MDN (implementing
HTMLAnchorElement.searchParams):
The
searchParamsreadonly property of theURLinterface returns aURLSearchParamsobject allowing access to theGETdecoded query arguments contained in the URL. - [Wayback/Archive] URLSearchParams – Web APIs | MDN
The
URLSearchParamsinterface defines utility methods to work with the query string of a URL. - [Wayback/Archive] Element.outerHTML – Web APIs | MDN (since
HTMLAnchorElementdescends fromElement)
TheouterHTMLattribute of theElementDOM interface gets the serialized HTML fragment describing the element including its descendants. It can also be set to replace the element with nodes parsed from the given string.To only obtain the HTML representation of the contents of an element, or to replace the contents of an element, use theinnerHTMLproperty instead.
JavaScript querying of elements
I wrote about this earlier in Bookmarklets for Archive.is and the WayBack Machine to go to the original page, but did not include many details, so here are more:
- [Wayback/Archive] javascript – How to use querySelector with an anchor tag with href? – Stack Overflow: Wrap the
hrefvalue in proper quotes. - [Wayback/Archive] html – How do I get the information from a meta tag with JavaScript? – Stack Overflow:
The other answers should probably do the trick, but this one is simpler and does not require jQuery:document.head.querySelector("[property~=video][content]").content;The original question used an RDFa tag with aproperty=""attribute. For the normal HTML<meta name="" …>tags you could use something like:document.querySelector('meta[name="description"]').content - [Wayback/Archive] Element.querySelector() – Web APIs | MDN
The
querySelector()method of theElementinterface returns the first element that is a descendant of the element on which it is invoked that matches the specified group of selectors.…
In this first example, the first
<style>element which either has no type or has type “text/css” in the HTML document body is returned:var el = document.body.querySelector("style[type='text/css'], style:not([type])"); - [Wayback/Archive] Document.querySelector() – Web APIs | MDN
TheDocumentmethodquerySelector()returns the firstElementwithin the document that matches the specified selector, or group of selectors. If no matches are found,nullis returned.Note: The matching is done using depth-first pre-order traversal of the document’s nodes starting with the first element in the document’s markup and iterating through sequential nodes by order of the number of child nodes. - [Wayback/Archive] Document.querySelectorAll() – Web APIs | MDN
The
DocumentmethodquerySelectorAll()returns a static (not live)NodeListrepresenting a list of the document’s elements that match the specified group of selectors.…
Here, an attribute selector is used to return a list of the list items contained within a list whose ID is
userlistwhich have adata-activeattribute whose value is1:const container = document.querySelector("#userlist"); const matches = container.querySelectorAll("li[data-active='1']"); - [Wayback/Archive] CSS selectors – CSS: Cascading Style Sheets | MDN
CSS selectors define the elements to which a set of CSS rules apply.
…
- Basic: universal, type, class, ID, attribute
- Grouping: selector list
- Combinators: descendant, child, general sibling, adjacent sibling, column
- Pseudo: pseudo classes, pseudeo elements
JavaScript string building
- [Wayback/Archive] Template literals (Template strings) – JavaScript | MDN
Template literals are string literals allowing embedded expressions. You can use multi-line strings and string interpolation features with them.They were called “template strings” in prior editions of the ES2015 specification.…Now, with template literals, you are able to make use of the syntactic sugar, making substitutions like this more readable:let a = 5; let b = 10; console.log(`Fifteen is ${a + b} and not ${2 * a + b}.`); // "Fifteen is 15 and // not 20."- via: [Wayback/Archive] javascript – How do I concatenate a string with a variable? – Stack Overflow (thanks [Wayback/Archive] necker and [Wayback/Archive] PleaseStand):
Since ECMAScript 2015, you can also use template literals (aka template strings):document.getElementById(`horseThumb_${id}`).className = "hand positionLeft";Query: [Wayback/Archive] javascript concatenate strings with number – Google Search
- via: [Wayback/Archive] javascript – How do I concatenate a string with a variable? – Stack Overflow (thanks [Wayback/Archive] necker and [Wayback/Archive] PleaseStand):
Getting link rel values
[Wayback/Archive] <link>: The External Resource Link element – HTML: HyperText Markup Language | MDN
[Wayback/Archive] How to get the url from link rel=”next” in with javascript – Stack Overflow (thanks [Wayback/Archive] Jes and [Wayback/Archive] Mohsen):
Q
How to get the url from
<link rel="prev" title="Selected 3" href="http://mydomain.com/2.html" />in the head using pure javascript?
A
IE8+
document.querySelector('link[rel="prev"]').href;
–jeroen
Code (which broke at 20230914 because of WordPress.com changes: the undocumented HighlanderComments structure got removed; I will update the gist later on and post an updated blog post)
[Wayback/Archive] Revisions · Scripts for “Some JavaScript bookmarklets for WordPress published pages centered around navigation and IDs” https://wiert.me/2023/07/20/some-javascript-bookmarklets-for-wordpress-published-pages-centered-around-navigation-and-ids/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.getElementsByName("comment_post_ID")[0]?.value | |
| // 85080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // HighlanderComments.homeURL // as of 20230914 this does not work any more as HighlanderComments got removed | |
| // Find this HTML element in stead and take the href: | |
| // <link rel='openid.delegate' href='https://wiert.me/' /> | |
| document.querySelector('link[rel="openid.delegate"]').href | |
| // 'https://wiert.me/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // {var a=document.createElement("a"); a.setAttribute("href", HighlanderComments.connectURL); a.pathname=''; a.search=''; a.hash=''; a.href; } // as of 20230914 this does not work any more as HighlanderComments got removed | |
| // Find the below HTML element in stead, then strip the "xmlrpc.php?rsd" from the end by removing the "pathname" and "search" bits | |
| // <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://wiert.wordpress.com/xmlrpc.php?rsd" /> | |
| {var a=document.createElement("a"); a.setAttribute("href", document.querySelector('link[rel="EditURI"]').href); a.pathname=''; a.search=''; a.hash=''; a.href; } | |
| // 'https://wiert.wordpress.com/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // {var a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=''; a.hash=''; a.href; } // as of 20230914 this does not work any more as HighlanderComments got removed | |
| // Find the below HTML element in stead, then strip the "xmlrpc.php?rsd" from the end by removing the "pathname" and "search" bits | |
| // <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://wiert.wordpress.com/xmlrpc.php?rsd" /> | |
| {var a=document.createElement("a"); a.href=document.querySelector('link[rel="EditURI"]').href; a.pathname=''; a.search=''; a.hash=''; a.href; } | |
| // 'https://wiert.wordpress.com/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.href; } // as of 20230914 this does not work any more as HighlanderComments got removed | |
| // Find the below HTML element in stead, then strip the "xmlrpc.php?rsd" from the end by removing the "pathname" and "search" bits | |
| // <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://wiert.wordpress.com/xmlrpc.php?rsd" /> | |
| {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=document.querySelector('link[rel="EditURI"]').href; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.href; } | |
| // 'https://wiert.wordpress.com/?p=85080' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname='wp-admin/post.php'; a.search=`post=${postID}&action=edit&classic-editor`; a.hash=''; a.href; } // as of 20230914 this does not work any more as HighlanderComments got removed | |
| // Find the below HTML element in stead, then strip the "xmlrpc.php?rsd" from the end by removing the "pathname" and "search" bits | |
| // <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://wiert.wordpress.com/xmlrpc.php?rsd" /> | |
| {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=document.querySelector('link[rel="EditURI"]').href; a.pathname='wp-admin/post.php'; a.search=`post=${postID}&action=edit&classic-editor`; a.hash=''; a.href; } | |
| // 'https://wiert.wordpress.com/wp-admin/post.php?post=85080&action=edit&classic-editor' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.title | |
| // 'Philosophy of management « The Wiert Corner – irregular stream of stuff' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.querySelector('meta[property="og:title"]')?.content | |
| // 'Philosophy of management' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.querySelector('meta[name="application-name"]')?.content | |
| // 'The Wiert Corner – irregular stream of stuff' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.text=document.title; a; } // as of 20230914 this does not work any more as HighlanderComments got removed | |
| // Find the below HTML element in stead, then strip the "xmlrpc.php?rsd" from the end by removing the "pathname" and "search" bits | |
| // <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://wiert.wordpress.com/xmlrpc.php?rsd" /> | |
| {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=document.querySelector('link[rel="EditURI"]').href; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.text=document.title; a; } | |
| // <a href="https://wiert.wordpress.com/?p=85080">Philosophy of management « The Wiert Corner – irregular stream of stuff</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; a; } // as of 20230914 this does not work any more as HighlanderComments got removed | |
| // Find the below HTML element in stead, then strip the "xmlrpc.php?rsd" from the end by removing the "pathname" and "search" bits | |
| // <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://wiert.wordpress.com/xmlrpc.php?rsd" /> | |
| {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=document.querySelector('link[rel="EditURI"]').href; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; a; } | |
| // <a href="https://wiert.wordpress.com/?p=85080" target="blank" rel="noopener">The Wiert Corner – irregular stream of stuff</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=HighlanderComments.connectURL; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; prompt("Anchor", a.outerHTML); } // as of 20230914 this does not work any more as HighlanderComments got removed | |
| // Find the below HTML element in stead, then strip the "xmlrpc.php?rsd" from the end by removing the "pathname" and "search" bits | |
| // <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://wiert.wordpress.com/xmlrpc.php?rsd" /> | |
| {var postID=document.getElementsByName("comment_post_ID")[0]?.value; a=document.createElement("a"); a.href=document.querySelector('link[rel="EditURI"]').href; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; prompt("Anchor", a.outerHTML); } | |
| // A popup titled “wiert.me” with a prompt named “Anchor” where you can copy this HTML from: | |
| // <a href="https://wiert.wordpress.com/?p=85080" target="blank" rel="noopener">Philosophy of management</a> |






Leave a comment