Tao Yu
Master
I hope this is the right section, as this is just a tiny piece of code that I put together.
This is a simple bookmarklet that lets you highlight text on a webpage and then view it on alg.garron.us or alg.cubing.net.
alg.cubing.net version
alg.garron.us version
I modified the code at the bottom of the Bookmarklet page on Wikipedia to make this. I can't take credit for writing the code. I just modified it so that it works with alg.garron.us and alg.cubing.net. I have next to no knowledge of javascript right now.
Obviously, credit goes to Lucas Garron for making alg.garron.us and alg.cubing.net.
How to install this:
This may differ with different browsers.
1. Bookmark this page.
2. Find the bookmark that you made and edit it (right click + Edit).
3. Copy and paste the code above into the "URL" box. Save your bookmark.
How to use this:
Highlight an algorithm on a page and open up the bookmark. A new tab should open with the algorithm entered into the algorithm box. Alternatively, pressing on the bookmark without highlighting something on a webpage will open up a popup asking you to enter an algorithm.
I hope that you will all find this useful.
Edit: I don't know what happened to the title of the thread...
Edit: Added '&type=alg' to the search path.
Edit: ’ is now automatically replaced by ' and R'2 is automatically replaced by R2'
This is a simple bookmarklet that lets you highlight text on a webpage and then view it on alg.garron.us or alg.cubing.net.
alg.cubing.net version
Code:
javascript:(function() {
function se(d) {
return d.selection ? d.selection.createRange().text : d.getSelection()
}
s = se(document);
for (i=0; i<frames.length && !s; i++) s = se(frames.document);
if (!s || s=='') s = prompt('Enter%20an%20algorithm%20to%20%20view%20on%20alg.cubing.net','');
if (s!=null&&s!=''){
open('http://alg.cubing.net/?alg=' + (s ? encodeURIComponent(s.toString().replace(/[’`]/g,"'").replace(/'(\d+)/g, "$1'")) :'')+'&type=alg').focus();
}
})();
alg.garron.us version
Code:
javascript:(function() {
function se(d) {
return d.selection ? d.selection.createRange().text : d.getSelection()
}
s = se(document);
for (i=0; i<frames.length && !s; i++) s = se(frames.document);
if (!s || s=='') s = prompt('Enter%20an%20algorithm%20to%20%20view%20on%20alg.cubing.net','');
if (s!=null&&s!=''){
open('http://alg.garron.us/?alg=' + (s ? encodeURIComponent(s.toString().replace(/[’`]/g,"'").replace(/'(\d+)/g, "$1'")) :'')).focus();
}
})();
I modified the code at the bottom of the Bookmarklet page on Wikipedia to make this. I can't take credit for writing the code. I just modified it so that it works with alg.garron.us and alg.cubing.net. I have next to no knowledge of javascript right now.
Obviously, credit goes to Lucas Garron for making alg.garron.us and alg.cubing.net.
How to install this:
This may differ with different browsers.
1. Bookmark this page.
2. Find the bookmark that you made and edit it (right click + Edit).
3. Copy and paste the code above into the "URL" box. Save your bookmark.
How to use this:
Highlight an algorithm on a page and open up the bookmark. A new tab should open with the algorithm entered into the algorithm box. Alternatively, pressing on the bookmark without highlighting something on a webpage will open up a popup asking you to enter an algorithm.
I hope that you will all find this useful.
Edit: I don't know what happened to the title of the thread...
Edit: Added '&type=alg' to the search path.
Edit: ’ is now automatically replaced by ' and R'2 is automatically replaced by R2'
Last edited: