Flickr Add Now Button

By Steffen J. Last update Mar 15, 2009 — Installed 177 times. Daily Installs: 1, 0, 0, 0, 2, 1, 0, 2, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 1, 0, 0
// ==UserScript==
// @name           Flickr Add Now Button
// @description    Adds a "Now" button to the photo date page
// @namespace      http://www.jakob.at/greasemonkey/
// @include        http://*flickr.com/photo_date_posted.gne*
// @version 0.1
// @creator Steffen A. Jakob (http://www.flickr.com/photos/steffenj/)
// ==/UserScript==
//
// Copyright (C) 2009 Steffen A. Jakob
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// The GNU General Public License is available by visiting
// http://www.gnu.org/copyleft/gpl.html
// or by writing to
// Free Software Foundation, Inc.
// 51 Franklin Street, Fifth Floor
// Boston, MA  02110-1301
// USA

// Changelog
// 2009-03-15 0.1
//     First public version

delta = GM_getValue('delta', '-1');
GM_registerMenuCommand('Post Now: difference to current time (minutes)', function() {
	delta = prompt('Difference to current time (minutes)', delta);
	GM_setValue('delta', delta);
	document.location.reload();
});

var t = document.getElementsByName("time").item(0);
var n = document.createElement('a');
n.appendChild(document.createTextNode('Now'));
n.setAttribute('href', '#');
var js = 'var n = new Date; n.setTime(n.getTime()+(' + delta + '*60000)); document.getElementsByName("time").item(0).value=n.getHours()+":"+n.getMinutes()+":"+n.getSeconds(); document.getElementsByName("date").item(0).value=n.getMonth()+1+"/"+n.getDate()+"/"+n.getFullYear();'
n.setAttribute('onclick', 'javascript: { ' + js + '};');
t.parentNode.appendChild(n);