public
Last active

Expanded Quix bookmarklet

  • Download Gist
Quic bookmarklet.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
javascript:Quix();function Quix() {
var e=encodeURIComponent; // shortcut for the function name
var t=window.getSelection ? window.getSelection():
(document.getSelection? document.getSelection(): (document.selection ? document.selection.createRange().text:'')); // Get selection or empty string
var c=window.prompt('Quix: Type `help` for a list of commands:');
if(t!='') {
if(c) {
c+=' '+t; // append selection to typed text
}
else {
c=''+t; // use the text in prompt
}
}
if(c) {
var u='http://quixapp.com/go/?c=' + e(c) +
'&t=' + (document.title?e(document.title):'') +
'&s=' + '&v=080' + '&u=' +
(document.location?e(document.location):'');
d=''+document.location;
if(d.substr(0,4)!='http') {
window.location=u+ '&mode=direct';
}
else {
heads=document.getElementsByTagName('head');
if(c.substring(0,1)==' ') {
var w=window.open(u+'&mode=direct');
w.focus();
}
else if (heads.length==0){
window.location= u + '&mode=direct';
}
else {
q=document.getElementById('quix');
if(q) {
q.parentNode.removeChild(q);
}
sc=document.createElement('script');
sc.src=u;
sc.id='quix';
sc.type='text/javascript';
void(heads[0].appendChild(sc));
}
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.