Comments by Edo78 on scripts
15 comments
|
Comment on: |
Now identi.ca has this function out of the box :-) |
|
Comment on: |
I'm thinking about writing a script like this one ... then I found it :-D |
|
Comment on: |
I like your extension but it's a little "problematic" with FF3.
es. Test Me! |
|
Comment on: |
I add a global
and change the div creation in updateScript to
but I'm thinking about made it customizable ... In my spare time I'll work on the auto-check function then I'll post my patch here so you can check it. |
|
Comment on: |
I have just a little request: can you made the position of the box configurable ?
Another request (not so little this time) is:
I'm thinking about writing a patch (with setTimeout, GM_setValue and GM_getValue so the timeout is persistent between sessions) but having it in the official version is a bigger advance. |
|
Comment on: |
I'm working on a keyboard shortcut.
What do you think about ? |
|
Comment on: |
@D.Bell
|
|
Comment on: |
I'm working on a complete rewrite version of this script with some new features. Stay tuned. |
|
Comment on: |
ok, now it's work again ;-) |
|
Comment on: |
Google Reader has changed to add more functionalities but this break my script, I'm working to solve this problem. |
|
Comment on: |
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: |
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.
|
|
Comment on: |
I have the same problem described by tcustomgolf ...
|
|
Comment on: |
I have changed onload: function(details) {
with onload: function(details) {
to make it work ... |
|
Comment on: |
I get a previous script and strongly clean to get the result I'm looking for.
P.S. sorry for my bad english |
