Comments on N-Dream's Scripts

34 comments

Comment on Advanced Google Keys made 14 hours ago:

soong

The blue boxes and numbers show up on google.com, but not on google.de (only left/right arrow buttons work). I use FF3.1. The script is active on google.tld/search* and http://google.tld/search*. Anyone got an idea?

Comment on Advanced Google Keys made Aug 28, 2008:

Thadk

just thought maybe a Copy to clipboard key would be handy without right clicking.

Comment on Advanced Google Keys made Aug 25, 2008:

Rense

Great, you rock! And Rudolf Noe too :). While I'm at it: is there a way to make this work on Google Scholar too?

Comment on Advanced Google Keys made Aug 25, 2008:

N-Dream

Updated the script.

Thanks to Rudolf Noe it works again :)

Cheers

Comment on Advanced Google Keys made Aug 21, 2008:

Rense

It seems like it broke today :(. The numbers are only partially shown or not at all; arrow down and up doesn't work. Please fix my favorite script...

Comment on Gmail2 Saved Searches made Jul 2, 2008:

N-Dream

I adopted Edo78 comments, should now work also with new version

Comment on Gmail2 Saved Searches made May 10, 2008:

Edo78

I'm working on a complete rewrite version of this script with some new features. Stay tuned.

Comment on Gmail2 Saved Searches made May 8, 2008:

Saibot

Nicely done, Edo78.

Any way to reduce the font size and/or position the box above the labels box?

Comment on Gmail2 Saved Searches made Apr 24, 2008:

Edo78

Yeah, I've done it !!!

// Copyright 2008 by N-Dream.com (Andrin von Rechenberg)

//
// ==UserScript==
// @name Gmail2 Saved Searches
// @namespace http://mail.google.com/
// @description Adds a Saved Search nav box to Gmail
// @include http://mail.google.com/*
// @include https://mail.google.com/*
// ==/UserScript==

window.addEventListener('load', function() {
if (unsafeWindow.gmonkey) {
unsafeWindow.gmonkey.load('1.0', init)
}
}, true);

function hostId() {
var id = "s";
var l = top.location.href;
var n = l.indexOf("mail.google.com/a/");
if (n != -1) {
l = l.substr(n + 18);
l = l.substr(0, l.indexOf("/"));
id += l;
}
return id;
}

function getData() {
return GM_getValue(hostId(), "to me directly|#search/to%3Ame\n");
}

function addSearchElement(gmail, module, text, search) {
var div = gmail.getNavPaneElement().ownerDocument.createElement('div');
with(div.style) {
background = 'white';
color = 'rgb(125,108,58)';
padding = '4px';
}

// Creating delete button
var del = document.createElement('span');
with(del.style) {
cursor = 'pointer';
}
del.appendChild(document.createTextNode('x'));
var newStyle = del.style.cssText + 'float:right;'
del.setAttribute('style', newStyle);

var h = hostId();
del.addEventListener('click', function(evt) {
window.setTimeout(function() {
var parts = getData();
parts = parts.split("\n");
newparts = "";
for (var i = 0; i < parts.length; ++i) {
if (parts[i].indexOf(text + "|") != 0) {
newparts += parts[i] + "\n";
}
}
GM_setValue(h, newparts);
redraw(gmail, module);
}, 0);
}, false);


// Creating label
var label = document.createElement('span');
label.appendChild(document.createTextNode(text));
with(label.style) {
cursor = 'pointer';
textDecoration = 'underline';
}

label.addEventListener('click', function(evt) {
top.location.hash = search;
}, false);

// Appending children
div.appendChild(del);
div.appendChild(label);
module.getContentElement().appendChild(div);
}

function addFooterElement(gmail, module) {
var div = gmail.getNavPaneElement().ownerDocument.createElement('div');
with(div.style) {
background = 'white';
color = 'rgb(125,108,58)';
padding = '4px';
fontSize = '80%';
}

// Creating help button
var help = document.createElement('span');
with(help.style) {
cursor = 'pointer';
}
help.appendChild(document.createTextNode('?'));
var newStyle = help.style.cssText + 'float:right;'
help.setAttribute('style', newStyle);
help.addEventListener('click', function(evt) {
window.location.href = "http://userscripts.org/scripts/show/20214";
}, false);

// Creating Save Button
var save = document.createElement('span');
save.appendChild(document.createTextNode("Save this search..."));
with(save.style) {
cursor = 'pointer';
textDecoration = 'underline';
}
var h = hostId();
save.addEventListener('click', function(evt) {
window.setTimeout(function() {
var name = "";
var current = getData();
while (name == "" ||
name.indexOf("|") != -1 ||
current.indexOf(name + "|") != -1) {
name = prompt("Please enter a name for this search", name);
if (name == null) {
return;
}
if (name.indexOf("|") != -1) {
alert("| is not allowed.")
}
if (current.indexOf(name + "|") != -1) {
alert("'" + name + "' is already taken.")
}
}
GM_setValue(h, current + name + "|" + top.location.hash + "\n");
redraw(gmail, module);
}, 0);
}, false);

// Appending children
div.appendChild(help);
div.appendChild(save);
module.getContentElement().appendChild(div);
}

function redraw(gmail, module) {
var m = module.getContentElement();
while (m.childNodes.length) {
m.removeChild(m.firstChild);
}
window.setTimeout(function() {
var parts = getData();
parts = parts.split("\n").sort();
for (var i = 0; i < parts.length; ++i) {
var n = parts[i].indexOf("|");
if (n != -1) {
addSearchElement(gmail, module, parts[i].substr(0, n),
parts[i].substr(n + 1));
}
}
addFooterElement(gmail, module);
}, 0);
}

function init(gmail) {
var module = gmail.addNavModule('Searches', '', 'rgb(251,216,117)');
redraw(gmail, module);
}



Maybe it can be better than this but it's just my second greasemonkey script ...

Comment on Gmail2 Saved Searches made Apr 24, 2008:

Edo78

I'm trying to fix this script but it has a lot of problem (I think because of gmail/greasemonkey update) one of that I can't yet fix completely :-(

The biggest problem is related to a greasemonkey update and is described here http://wiki.greasespot.net/0.7.20080121.0_compa...

I'm not to good in javascript programming (not yet ;-) at least) and change the getData function into

function getData() {

var value;
window.setTimeout(function() {
value = GM_getValue(hostId(), "to me directly|#search/to%3Ame\n");
}, 0);
while(typeof(value)=="undefined") {
/* if you know how to use a "sleep" like function you can safely remove this crappy alert*/
alert("this alert is useful only to wait for the setTimeou to retrive the searches");
}
return value;
}


that crappy alert is really annoying but it's the only method I find in this short time (I'm not a javascript programmer and I'm at work).

The second problem is a little one, probably coming from a gmail update ... every window.location must be changed in top.location because gmail load itself in a frame.

Hoping this can help.

Meanwhile I try to solve the "alert" problem ...

Comment on Gmail2 Saved Searches made Apr 24, 2008:

Edo78

I have the same problem described by tcustomgolf ...

I try it in a clean FF profile only with greasemonkey and your script :-(

Comment on GMailTo by N-Dream made Apr 20, 2008:

Julien Couvreur

For those interested:

Here is the original "Mailto Compose in GMail" (which was feature in the Greasemonkey Hacks book and handles all the mailto: url formats):

http://userscripts.org/scripts/show/595

Comment on Gmail2 Saved Searches made Jan 30, 2008:

tcustomgolf

Not working for me...I get the arrow and searches bar, but when I try to open the bar to expand, nothing shows....and I disable all other GM scripts..

Comment on Gmail2 Saved Searches made Jan 15, 2008:

Saibot

FYI, there is a conflict between this script and the TopLabels script. When TopLabels is installed, the saved searches do not load properly.

For me, Saved Searches is preferable to TopLabels, but it'd be nice to be able to use both.

Comment on Advanced Google Keys made Oct 17, 2007:

Ophir

Fantastic work! Thank you.

Comment on Advanced Google Keys made Jul 20, 2007:

mugnebot

It doesn't work well with GoogleMonkeyR. It won't scroll when you go down the results, and if you scroll manually and then press j/k, it jumps back to the top of the page.

Comment on Advanced Google Keys made Jul 8, 2007:

Chris Rayner

If you change the condition on line 130 to '(e.keyCode==13 || e.keyCode == 79)', the letter 'o' will open the current selection as well -- just like in gmail.

Comment on GMailTo by N-Dream made May 10, 2007:

jacotyco

could you make it so it opens in a new tab?

Comment on GMailTo by N-Dream made Mar 27, 2007:

Mike Cunneen

Here is a hacked source to open a gmail compose window, as requested. YMMV.



// ==UserScript==

// @name GMailTo

// @namespace andrinvr@gmail.com

// @description Forces all mailto links to open in GMail

// @include *

// ==/UserScript==

//Super fast recursive lookup if it is a mailto: link

function goUp(target,howmany) {

if(howmany>0) {

if(target.nodeName=="A") {

if(target.href.indexOf("mailto:")==0) {

mail=target.href.substring(7);

if((strip=mail.indexOf("?"))!=-1) {

mail=mail.substring(0,strip);

}

if((strip=mail.indexOf("&"))!=-1) {

mail=mail.substring(0,strip);

}

//target.href="http://mail.google.com/mail/?view=cm&fs=1&tf=1&amp;to="+mail;

var mailwin = window.open("https://mail.google.com/mail/?view=cm&tf=0&to="+mail+"&cc=&su=&body=&fs=1","mailwin","menubar=no,toolbar=no,location=no,directories=no,personalbar=no,status=no,dependent=yes,width=640,height=480");

//target.target="_blank";

target.href = null;

target.target = null;

mailwin.focus();

return false;

} else {

return;

}

} else {

if(target.parentNode!=null) {

goUp(target.parentNode,--howmany);

} else {

return;

}

}

} else {

return;

}

}

window.addEventListener("click",function(e) {

if(e.which==1) {

mail=goUp(e.target,5)

}

}, false);

Comment on Advanced Google Keys made Dec 25, 2006:

Chris M

Awesome script! Sometimes it takes a few tries to scroll down with the down-key, but other than that it works great.

Comment on Advanced Google Keys made Dec 15, 2006:

Yevgen Gorshkov

This script does not work if "Search for text when I start typing" Firefox option is enabled.

Comment on Advanced Google Keys made Dec 13, 2006:

Vladimir Bukreev

I've found temporary fix for Yandex compatibility. It's pretty simple - change line 41 of original js script, it should be

if (allP[i].className=="title") {

So, it's only matter of className ;)))

Comment on Advanced Google Keys made Dec 13, 2006:

Vladimir Bukreev

This is just awesome!!! Superb script! Is there an easy way to adapt it to other search engines? I personally want this script for Yandex.

Comment on Advanced Google Keys made Dec 12, 2006:

dsjkvf

strange, (r) doesn't seem to work for me (Fx 1.5.0.8/Mac, can also try 2.0/Win tomorrow) -- just focuses search string exactly the way (e) does.

can anybody confirm it?

Comment on GMailTo by N-Dream made Dec 8, 2006:

sleijer

Nice little script.

Could someone tweak the script so that clicking a mailto-link would pop up a Gmail compose window, which closes automatically after you have sent the e-mail. My javascript skills are non-existent :).