[英]A bookmarklet to use a portion of the current URL in a new URL
I'm wanting to make a bookmarklet that would change a webpage from 我想制作一个可以更改网页的书签
http://user.tumblr.com/post/123456789 to http://user.tumblr.com/post/123456789至
http://user.tumblr.com/liked/by/user http://user.tumblr.com/liked/by/user
with just a click. 只需点击一下。 I'm usually alright at frankensteining code together, and I've been looking at the Tumblr manual reblog button that uses "window.location" along with Bookmarklet to edit current URL and Replace end characters of current URL with bookmarklet
我通常对弗兰肯斯坦代码都没事,我一直在看Tumblr手动重新博客按钮,该按钮使用“ window.location”和Bookmarklet来编辑当前URL并将当前URL的 结尾字符替换为书签
I can't see anything useable that would extract a subdomain into a variable and then place it in a new URL. 我看不到任何有用的东西,它将子域提取到变量中,然后将其放置在新的URL中。 I did stumble across this code:
我确实偶然发现了这段代码:
^http://([^.]+)\.domain\.com
But I have no idea what that means or how to use it. 但是我不知道这意味着什么或如何使用它。
Not sure if this is what your looking for, but I use as I have multiple instances of my site and what bookmarks to keep me in the same instance regardless of port or protocol. 不确定这是否是您要寻找的东西,但是我使用了我的站点的多个实例,并且使用了哪些书签可以使我保持在同一实例中,而不管端口或协议如何。
New Tab 新标签
javascript:(function(){window.open(location.protocol+'//'+location.hostname+':'+location.port+'/liked/by/user')})();
Current Tab 当前标签
javascript:(function(){window.location.assign(location.protocol+'//'+location.hostname+':'+location.port+'/liked/by/user')})();
EDIT: Forgot to put code blocks 编辑:忘记放置代码块
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.