-
Notifications
You must be signed in to change notification settings - Fork 0
Bookmarklets
alex [dot] kramer [at] g_m_a_i_l [dot] com edited this page Mar 6, 2025
·
7 revisions
Generate bookmarklets from javascript using https://bookmarklets.org/maker/ or http://mrcoles.com/bookmarklet/.
Add current page to Pocket.
javascript:(function(){var url = encodeURIComponent(window.location.href); var pocketUrl = 'https://getpocket.com/save?url=%27%20+%20url;%20window.open(pocketUrl,%20%27_blank%27);})();
https://efe.me/posts/2025-03-02-pocket-universal-browser-extension/
javascript:(function(){
var url = encodeURIComponent(window.location.href);
var pocketUrl = "https://getpocket.com/save?url=" + url;
window.open(pocketUrl, '_blank');
})();
Add neon borders to all page elements.
javascript:(function()%7Bvar%20css%20%3D%20'body%20*%20%7B%20border%3A%201px%20dashed%20magenta%20!important%3B%20%7D'%2Cstyle%20%3D%20document.createElement('style')%3Bdocument.head.appendChild(style)%3Bstyle.type%20%3D%20'text%2Fcss'%3Bstyle.appendChild(document.createTextNode(css))%7D)()
var css = 'body * { border: 1px dashed magenta !important; }',
style = document.createElement('style');
document.head.appendChild(style);
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
Increase content width on sites that often display code that is longer than the content width.
javascript:(function()%7Bvar%20host%20%3D%20location.hostname%3Bif%20(host.includes('github.com'))%20%7Bdocument.querySelectorAll('.repository-content')%5B0%5D.style.width%20%3D%20%221375px%22%3Bdocument.querySelectorAll('.discussion-timeline')%5B0%5D.style.width%20%3D%20%221150px%22%3Bvar%20containers%20%3D%20document.querySelectorAll('.container')%3Bcontainers.forEach(function(e)%20%7Be.style.marginLeft%20%3D%20%2220px%22%3B%7D)%3B%7Dif%20(host.includes('stackoverflow.com')%20%7C%7C%20host.includes('stackexchange.com'))%20%7Bdocument.querySelectorAll('%23content')%5B0%5D.style.width%20%3D%20%221450px%22%3Bvar%20posts%20%3D%20document.querySelectorAll('.post-text')%3Bposts.forEach(function(e)%20%7Be.style.width%20%3D%20%221150px%22%3B%7D)%3B%7D%2F*%20JQuery%20no%20longer%20loads%20on%20githubvar%20host%20%3D%20location.hostname%3Bif%20(host.includes('github.com'))%20%7B%24('.repository-content').width(1100)%3B%7Dif%20(host.includes('stackoverflow.com')%20%7C%7C%20host.includes('stackexchange.com'))%20%7B%24('%23content').width(1450)%3B%24('.post-text').each(function(e)%20%7B%24(this).width(1150)%7D)%3B%7D*%2F%7D)()
var host = location.hostname;
if (host.includes('github.com')) {
document.querySelectorAll('.repository-content')[0].style.width = "1375px";
document.querySelectorAll('.discussion-timeline')[0].style.width = "1150px";
var containers = document.querySelectorAll('.container');
containers.forEach(function(e) {e.style.marginLeft = "20px";});
}
if (host.includes('stackoverflow.com') || host.includes('stackexchange.com')) {
document.querySelectorAll('#content')[0].style.width = "1450px";
var posts = document.querySelectorAll('.post-text');
posts.forEach(function(e) {e.style.width = "1150px";});
}
/* JQuery no longer loads on github
var host = location.hostname;
if (host.includes('github.com')) {
$('.repository-content').width(1100);
}
if (host.includes('stackoverflow.com') || host.includes('stackexchange.com')) {
$('#content').width(1450);
$('.post-text').each(function(e) {$(this).width(1150)});
}
*/
javascript:(function()%7Bfunction%20callback()%7B(function(%24)%7Bvar%20jQuery%3D%24%3Balert(%22PnL%3A%20%22%20%2B%20%24(%22.posChange%2C%20.negChange%22).map(%20function()%20%7B%20return%20this.innerText%3B%20%7D%20).toArray().reduce(function(tot%2C%20num)%20%7B%20return%20parseFloat(tot)%20%2B%20parseFloat(num)%3B%20%7D))%7D)(jQuery.noConflict(true))%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.11.1%2Fjquery.min.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
alert("PnL: " + $(".posChange, .negChange").map( function() { return this.innerText; } ).toArray().reduce(function(tot, num) { return parseFloat(tot) + parseFloat(num); }))