How to Use Bookmarks#
I accidentally discovered that JavaScript can be used in URLs, which is the premise. In daily use, some functions are specifically written as extensions for this purpose, which is a bit of a fuss. At this time, bookmarks can be used, which is convenient and also increases portability.
Bing to Google Search#
- Description: I usually use Bing as my search engine, but sometimes I am not satisfied with the content of Bing and need to search again on Google. Because of the existence of the new Bing, I don't want to change the default search engine, but it is inconvenient to open Google and search again. Therefore, I added a bookmark for this.
- Code Explanation:
var currentUrl = window.location.href; // Get the current URL var reg = /q=([^&]+)/; var res = currentUrl.match(reg); // Match using regular expressions var googleUrl = "https://www.google.com/search?q="; var resultUrl = googleUrl+res[1]; // Concatenate window.open(resultUrl,'_self').close(); // Open the new website and close the original website
- Bookmark URL
{% note success %}
javascript:var currentUrl = window.location.href;var reg = /q=([^&]+)/;var res = currentUrl.match(reg);var googleUrl = "https://www.google.com/search?q=";var resultUrl = googleUrl+res[1];window.open(resultUrl,'_self').close();
{% endnote %} - Note: The regular expression was written by new Bing, and it feels like a beautiful NTR (Note: NTR is a term used in Japanese adult content, referring to a situation where a partner is stolen or taken away by someone else).
Remove Song List Limitation on Netease Cloud Music#
- Description: The web version of Netease Cloud Music has a limitation on the number of songs displayed in a playlist, only showing 20 songs. I don't want to download the client because of this, so I added this bookmark.
- Code:
document.cookie="os=pc"; window.location.reload(); // Reload the webpage
- Bookmark URL
{% note success %}
javascript:document.cookie="os=pc";window.location.reload();
{% endnote %}