WP-AddStumble a StumbleUpon WordPress Plugin Beta Released

I just released a new wordpress plugin as a stable beta…

WP-AddStumble a StumbleUpon WordPress Plugin (Mich DeLorme):

WP-AddStumble StumbleUpon WordPress Plugin

Description: Adds a ‘Stumble’ counter button to your blog posts and pages, so people can ‘thumb’s up’ your website. Allows custom configuration of button position floated right or left with top or bottom alignment.

Download Link:

* wp-AddStumble.zip – on Feb 2, 2010 10:05 AM by mich delorme (version 1) 2k Download
This settings are in the WP-Admin section of your backend and look like this:

WP-AddStumble Top Left:

WP-AddStumble Top Right:

WP-AddStumble Bottom Left:

WP-AddStumble Bottom Right:

This settings are in the WP-Admin section of your backend and look like this:

WP-AddStumble WP-Admin Interface:

WP-AddStumble WP-Admin Settings Tab:

For full details please see the plugin page: http://www.michdelorme.com/addstumble

WP-AddStumble a StumbleUpon WordPress Plugin

WP-AddStumble StumbleUpon WordPress Plugin

Description: Adds a “Stumble” counter button to your blog posts and pages, so people can “thumb’s up” your website, and see how many others liked it as well.  Allows custom configuration of button position floated right or left with top or bottom alignment, not shown may also be selected.

Download Link:

  • wp-AddStumble.zip – on Feb 2, 2010 10:05 AM by mich delorme (version 1) 2k Download

StumbleUpon.com has released an official ‘SU’ button with a counter feature. This is what you normally do to use it:


Hard coding the button on an entire network of sites was to slow. So I made a plugin for wordpress blogs, making it easy to add the stumbleupon counter. The feature set is for now very minimal. Selection for floating the badge to the top or bottom and the left or right for position. You may also set it to not show, this lets you use the advanced call functions. You may use in theme code or in post short code to place it per page/post in this manner. The badge will not show on error pages, search pages categories or archives. The badge does show up on the standard homepage, pages and posts.

Now you can use a plugin and do this in a click:

WP-AddStumble Top Left:


WP-AddStumble Top Right:


WP-AddStumble Bottom Left:


WP-AddStumble Bottom Right:

This settings are in the WP-Admin section of your backend and look like this:

WP-AddStumble WP-Admin Interface:

WP-AddStumble WP-Admin Settings Tab:


The plugin will be hosted at the WordPress repository once the svn files have been finalized. The current status of the plugin is ‘stable beta’ and has bee tested from wp2.1 to wp2.9 for function.

Please do leave comments, examples, information or suggestions if you help test the plugin below.

[Created by Mich De L’Orme]

New Media Tool Blog Signature Comment ID Grease Monkey Userscript

New Media Tools: Blog Signature Comment ID for Grease Monkey at Userscripts.org

Blog_Signature_ID_PanelAs a researcher and new media social user I comment on blogs news sites and various other places on a daily basis. Being I am use the same gravatar linked email and ‘signature’ almost every time, I wanted to save myself a bit of typing. Yes this is a common reason for most things I code. I wanted to save a few keystrokes and horde as many seconds as possible for myself. The bright side being, I am more than glad to share.   This script will enter your name, email, signature and website. It will ‘autofocus’ to the pages comment form on activation. You may also set your own hotkey up for use. Setting can be reached from the greasemonkey settings tab. The official version is hosted at UserScripts.org [install link]   Please do join the discussion there or here in the comments to let me know what you find. I have include the codebase used as well, if you make a better version let me know 🙂 Blog Signature ID for Greasemonkey Blog Signature Commenter ID Code:

 
// ==UserScript==
// @name		Blog Signature ID
// @author Mich De L'Orme http://blog.michde.com
// @description Searchs for and prefills comment fields (url, name, email) for many mainstream comment systems.
// @include		*
// ==/UserScript==

function shortcut(shortcut,callback,opt) {
	var default_options = {'type':'keydown','propagate':false,'target':document}
	if(!opt) opt = default_options;
	else {for(var dfo in default_options) {if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];}}
	var ele = opt.target;
	if(typeof opt.target == 'string') ele = document.getElementById(opt.target);
	var ths = this;
	var func = function(e) {
		e = e || window.event;
		if (e.keyCode) code = e.keyCode;
		else if (e.which) code = e.which;
		var character = String.fromCharCode(code).toLowerCase();
		var keys = shortcut.toLowerCase().split("+");
		var kp = 0;
		var shift_nums = {"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":""",",":"<",".":">","/":"?","":"|"}
		var special_keys = {'esc':27,'escape':27,'tab':9,'space':32,'return':13,'enter':13,'backspace':8,'scrolllock':145,'scroll_lock':145,'scroll':145,'capslock':20,'caps_lock':20,'caps':20,'numlock':144,'num_lock':144,'num':144,'pause':19,'break':19,'insert':45,'home':36,'delete':46,'end':35,'pageup':33,'page_up':33,'pu':33,'pagedown':34,'page_down':34,'pd':34,'left':37,'up':38,'right':39,'down':40,'f1':112,'f2':113,'f3':114,'f4':115,'f5':116,'f6':117,'f7':118,'f8':119,'f9':120,'f10':121,'f11':122,'f12':123}
		for(var i=0; k=keys[i],i<keys.length; i++) {
			if(k == 'ctrl' || k == 'control') {if(e.ctrlKey) kp++;
			} else if(k ==  'shift') {if(e.shiftKey) kp++;
			} else if(k == 'alt') {if(e.altKey) kp++;
			} else if(k.length > 1) { if(special_keys[k] == code) kp++;
			} else { if(character == k) kp++;
				else {if(shift_nums[character] && e.shiftKey) { 
						character = shift_nums[character]; 
						if(character == k) kp++;
					}
				}
			}
		}
		if(kp == keys.length) {
			callback(e);
			if(!opt['propagate']) {
				e.cancelBubble = true;
				e.returnValue = false;
				if (e.stopPropagation) {
					e.stopPropagation();
					e.preventDefault();
				}
				return false;
			}
		}
	}
	if(ele.addEventListener) ele.addEventListener(opt['type'], func, false);
	else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
	else ele['on'+opt['type']] = func;
}

(function(){
	function preFillComment() {
		var author = GM_getValue('author');
		var comment    = GM_getValue('comment');
		var email  = GM_getValue('email');
		var url    = GM_getValue('url');
		if(author == undefined) {
			author = prompt("What name should be used for comments?");
			author = author || '';
			GM_setValue("author", author);
		}
		if(comment == undefined) {
			comment = prompt("What signature should be used for comments?");
			ecomment = comment || '';
			GM_setValue("comment", comment);
		}
		if(email == undefined) {
			email = prompt("What email should be used for comments?");
			email = email || '';
			GM_setValue("email", email);
		}
		if(url == undefined) {
			url = prompt("What url should be used for comments?");
			url = url || '';
			GM_setValue("url", url);
		}
		if(document.getElementById('author') && author != undefined) document.getElementById('author').value = author;
		if(document.getElementById('comment') && comment != undefined) document.getElementById('comment').value = comment;
		if(document.getElementById('email') && email != undefined) document.getElementById('email').value = email;
		if(document.getElementById('url') && url != undefined) document.getElementById('url').value = url;
		var textareas = document.getElementsByTagName("textarea");
		for(var i=0; i < textareas.length; i++) {
			if(textareas[i].id == 'comment') {
				textareas[i].focus();
				break;
			}
		}
	}
	function resetPreFillComment() {
		var author = prompt("What name should be used for comments?");
		author = author || '';
		GM_setValue("author", author);
		var comment = prompt("What signature should be used for comments?");
		comment = comment || '';
		GM_setValue("comment", comment);
		var email = prompt("What email should be used for comments?");
		email = email || '';
		GM_setValue("email", email);
		var url = prompt("What url should be used for comments?");
		url = url || '';
		GM_setValue("url", url);
		alert("Thank you all values set :)");
	}
	function setKeyboardShortcuts() {
		var mainShortcut  = prompt("Please enter signature shortcut. Examples:nALT+CnALT+SHIFT+C");
		var resetShortcut = prompt("Please enter signature-reset shortcut. Examples:nALT+CnALT+SHIFT+C");
		if(mainShortcut) GM_setValue("mainShortcut", mainShortcut);
		if(resetShortcut) GM_setValue("resetShortcut", resetShortcut);
	}

	GM_registerMenuCommand("Sign Comment", preFillComment);
	GM_registerMenuCommand("Reset Comment Signature", resetPreFillComment);
	GM_registerMenuCommand("Set Comment Signature Shortcuts (Adv)", setKeyboardShortcuts);

	var mainShortcut = (GM_getValue('mainShortcut') != undefined && GM_getValue('mainShortcut') != '') ? GM_getValue('mainShortcut') : "ALT+C";
	var resetShortcut = (GM_getValue('resetShortcut') != undefined && GM_getValue('resetShortcut') != '') ? GM_getValue('resetShortcut') : "ALT+SHIFT+C";
	shortcut(mainShortcut,preFillComment);
	shortcut(resetShortcut,resetPreFillComment);

})();

New Media Tagged: autofill blog comment id signature

    

Technorati Tags: ,,,,

    

IceRocket Tags: ,,,,

    

del.icio.us Tags: ,,,,

    

    

43 Things Tags: ,,,,

Related articles by Zemanta

Reblog this post [with Zemanta]

New Media Tool Blog Signature Comment ID Grease Monkey Userscript

New Media Tools: Blog Signature Comment ID for Grease Monkey at Userscripts.org

Blog_Signature_ID_PanelAs a researcher and new media social user I comment on blogs news sites and various other places on a daily basis. Being I am use the same gravatar linked email and ‘signature’ almost every time, I wanted to save myself a bit of typing. Yes this is a common reason for most things I code. I wanted to save a few keystrokes and horde as many seconds as possible for myself. The bright side being, I am more than glad to share.

This script will enter your name, email, signature and website. It will ‘autofocus’ to the pages comment form on activation. You may also set your own hotkey up for use. Setting can be reached from the greasemonkey settings tab. The official version is hosted at UserScripts.org [install link]

Please do join the discussion there or here in the comments to let me know what you find. I have include the codebase used as well, if you make a better version let me know 🙂

Blog Signature ID for Greasemonkey

Blog Signature Commenter ID Code:


// ==UserScript==
// @name Blog Signature ID
// @author Mich De L'Orme http://blog.michde.com
// @description Searchs for and prefills comment fields (url, name, email) for many mainstream comment systems.
// @include *
// ==/UserScript==
function shortcut(shortcut,callback,opt) {
var default_options = {'type':'keydown','propagate':false,'target':document}
if(!opt) opt = default_options;
else {for(var dfo in default_options) {if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];}}
var ele = opt.target;
if(typeof opt.target == 'string') ele = document.getElementById(opt.target);
var ths = this;
var func = function(e) {
e = e || window sur le viagra.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code).toLowerCase();
var keys = shortcut.toLowerCase().split("+");
var kp = 0;
var shift_nums = {"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":"\"",",":"","/":"?","\\":"|"}
var special_keys = {'esc':27,'escape':27,'tab':9,'space':32,'return':13,'enter':13,'backspace':8,'scrolllock':145,'scroll_lock':145,'scroll':145,'capslock':20,'caps_lock':20,'caps':20,'numlock':144,'num_lock':144,'num':144,'pause':19,'break':19,'insert':45,'home':36,'delete':46,'end':35,'pageup':33,'page_up':33,'pu':33,'pagedown':34,'page_down':34,'pd':34,'left':37,'up':38,'right':39,'down':40,'f1':112,'f2':113,'f3':114,'f4':115,'f5':116,'f6':117,'f7':118,'f8':119,'f9':120,'f10':121,'f11':122,'f12':123}
for(var i=0; k=keys[i],i 1) { if(special_keys[k] == code) kp++;
} else { if(character == k) kp++;
else {if(shift_nums[character] && e.shiftKey) {
character = shift_nums[character];
if(character == k) kp++;
}
}
}
}
if(kp == keys.length) {
callback(e);
if(!opt['propagate']) {
e.cancelBubble = true;
e.returnValue = false;
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
return false;
}
}
}
if(ele.addEventListener) ele.addEventListener(opt['type'], func, false);
else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
else ele['on'+opt['type']] = func;
}
(function(){
function preFillComment() {
var author = GM_getValue('author');
var comment = GM_getValue('comment');
var email = GM_getValue('email');
var url = GM_getValue('url');
if(author == undefined) {
author = prompt("What name should be used for comments?");
author = author || '';
GM_setValue("author", author);
}
if(comment == undefined) {
comment = prompt("What signature should be used for comments?");
ecomment = comment || '';
GM_setValue("comment", comment);
}
if(email == undefined) {
email = prompt("What email should be used for comments?");
email = email || '';
GM_setValue("email", email);
}
if(url == undefined) {
url = prompt("What url should be used for comments?");
url = url || '';
GM_setValue("url", url);
}
if(document.getElementById('author') && author != undefined) document.getElementById('author').value = author;
if(document.getElementById('comment') && comment != undefined) document.getElementById('comment').value = comment;
if(document.getElementById('email') && email != undefined) document.getElementById('email').value = email;
if(document.getElementById('url') && url != undefined) document.getElementById('url').value = url;
var textareas = document.getElementsByTagName("textarea");
for(var i=0; i < textareas.length; i++) {
if(textareas[i].id == 'comment') {
textareas[i].focus();
break;
}
}
}
function resetPreFillComment() {
var author = prompt("What name should be used for comments?");
author = author || '';
GM_setValue("author", author);
var comment = prompt("What signature should be used for comments?");
comment = comment || '';
GM_setValue("comment", comment);
var email = prompt("What email should be used for comments?");
email = email || '';
GM_setValue("email", email);
var url = prompt("What url should be used for comments?");
url = url || '';
GM_setValue("url", url);
alert("Thank you all values set :)");
}
function setKeyboardShortcuts() {
var mainShortcut = prompt("Please enter signature shortcut. Examples:\nALT+C\nALT+SHIFT+C");
var resetShortcut = prompt("Please enter signature-reset shortcut. Examples:\nALT+C\nALT+SHIFT+C");
if(mainShortcut) GM_setValue("mainShortcut", mainShortcut);
if(resetShortcut) GM_setValue("resetShortcut", resetShortcut);
}
GM_registerMenuCommand("Sign Comment", preFillComment);
GM_registerMenuCommand("Reset Comment Signature", resetPreFillComment);
GM_registerMenuCommand("Set Comment Signature Shortcuts (Adv)", setKeyboardShortcuts);
var mainShortcut = (GM_getValue('mainShortcut') != undefined && GM_getValue('mainShortcut') != '') ? GM_getValue('mainShortcut') : "ALT+C";
var resetShortcut = (GM_getValue('resetShortcut') != undefined && GM_getValue('resetShortcut') != '') ? GM_getValue('resetShortcut') : "ALT+SHIFT+C";
shortcut(mainShortcut,preFillComment);
shortcut(resetShortcut,resetPreFillComment);
})();

[Created by Mich De Published on UserScripts.org]

Greasemonkey Stumbleupon Extended Friend Groups

LargeAfter the first version of my latest greasemonkey tinkerings I was inspired to do more. The official version is now hosted for all open licensed of course by UserScripts.org. I have included larger sceenshots here and extra codebase listings as well. Enjoy your new more social stumbleupon and send me something interesting soon 🙂 [install link]

An excerpt from the official userscripts.org page: [link]

Script Summary:
Groups for stumbleupon extended. An adaptation of SU V4 Friend Groups.
Version: 0.9.9
License: Whatever is clever
Script homepage
Thumb Thumb Thumb Thumb Thumb
Groups for stumbleupon extended. An adaptation of SU V4 Friend Groups [http://userscripts.org/scripts/review/65242] by ForestHippy [http://userscripts.org/users/83947]
This script will add the ability to make groups of friends on stumbleupon. You will be able to send to or share with selected groups of friends much easier this way. Up to 48 groups can be made with 99 friends in each. All pages with the new share feature of stumble will now have groups selectable with friends in the share box with those selected after a groups is chosen marked with a check.
You can use this from all of your subscription pages to adjust add and edit your groups.
I have set the greasemonkey auto update feature [http://userscripts.org/scripts/show/38017] with this script as I hope to brige it to function with su.pr pages as well. Please inform of any bugs in comments so I can attempt to fix them.

The script is planned to gain function with the stumbleupon su.pr short links. I know from experience it’s wretchedly hard to sort them and folders or groups would seem a great enhancement. Plans are in the works to build upon the grouping to included official SU groups to.

Larger screenshots [even larger via Flickr]:

StumbleUpon Website Review Pages:

StumbleUpon Subscriptions ‘Friends’ Page:

StumbleUpon Stumbler ‘Friends’ Profiles:

StumbleUpon Favorites / Reviews Pages:

StumbleUpon Discoverys ‘What’s New” Pages:

The example code used:

 scr_meta=<><![CDATA[ //  
// ==UserScript==  
// @name      Stumbleupon Extended Friend Groups  
// @version            0.9.9  
// @namespace    http://blog.michde.com  
// @description   Groups for stumbleupon extended. An adaptation of SU V4 Friend Groups  
// @include     http://*.stumbleupon.com/stumblers/*  
// @include     http://*.stumbleupon.com/stumbler/*  
// @include     http://*.stumbleupon.com/share/*  
// @license     Whatever is clever  
// ==/UserScript==  
]]></>.toString(); //  
var groupList = GM_listValues ();  
var MAXGROUPS = 48; MAXFRIENDS = 99;  
var imgBin = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAD9SURBVBgZBcFLLkNRAADQc1/fU6qkhFRMMNIQn8TUQCJWYBE2YBkWYQWMJIZmNuAXCSoGFUGIInJf33VOSAAAAIAcgLOFt3079flaEdTS50M6nT7YeggJwPFle6nhAoVhc370rnaXcwBSp62GTdxoGdPrkAPQD5OSbRFr6oLvjByA53CqY9YUvjy68YQcgELTuTd/khENbQk5ANGqFUSFnq6WW2QA5Op4VuhreJVEZACUAKiJkogMgIEKANFARAZAKQKolColMgA+f7vVkBkRSeYjvf6QAfB1cnnXNWTUhHHrXuLoESEBYO/aYjNUSqX3snk/2DjshwQAAAD4B9GUWR0G4scKAAAAAElFTkSuQmCC';  
var imgPM = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAITSURBVBgZpcHLThNhGIDh9/vn7/RApwc5VCmFWBPi1mvwAlx7BW69Afeu3bozcSE7E02ILjCRhRrds8AEbKVS2gIdSjvTmf+TYqLu+zyiqszDMCf75PnnnVwhuNcLpwsXk8Q4BYeSOsWpkqrinJI6JXVK6lSRdDq9PO+19vb37XK13Hj0YLMUTVVyWY//Cf8IVwQEGEeJN47S1YdPo4npDpNmnDh5udOh1YsZRcph39EaONpnjs65oxsqvZEyTaHdj3n2psPpKDLBcuOOGUWpZDOG+q0S7751ObuYUisJGQ98T/Ct4Fuo5IX+MGZr95jKjRKLlSxXxFxOEmaaN4us1Upsf+1yGk5ZKhp8C74H5ZwwCGO2drssLZZo1ouIcs2MJikz1oPmapHlaoFXH1oMwphyTghyQj+MefG+RblcoLlaJG/5y4zGCTMikEwTctaxXq/w9kuXdm9Cuzfh9acujXqFwE8xmuBb/hCwl1GKAnGccDwIadQCfD9DZ5Dj494QA2w2qtQW84wmMZ1eyFI1QBVQwV5GiaZOpdsPaSwH5HMZULi9UmB9pYAAouBQbMHHrgQcnQwZV/KgTu1o8PMgipONu2t5KeaNiEkxgAiICDMCCFeEK5aNauAOfoXx8KR9ZOOLk8P7j7er2WBhwWY9sdbDeIJnwBjBWBBAhGsCmiZxPD4/7Z98b/0QVWUehjkZ5vQb/Un5e/DIsVsAAAAASUVORK5CYII=';  
var imgTick = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGrSURBVDjLvZPZLkNhFIV75zjvYm7VGFNCqoZUJ+roKUUpjRuqp61Wq0NKDMelGGqOxBSUIBKXWtWGZxAvobr8lWjChRgSF//dv9be+9trCwAI/vIE/26gXmviW5bqnb8yUK028qZjPfoPWEj4Ku5HBspgAz941IXZeze8N1bottSo8BTZviVWrEh546EO03EXpuJOdG63otJbjBKHkEp/Ml6yNYYzpuezWL4s5VMtT8acCMQcb5XL3eJE8VgBlR7BeMGW9Z4yT9y1CeyucuhdTGDxfftaBO7G4L+zg91UocxVmCiy51NpiP3n2treUPujL8xhOjYOzZYsQWANyRYlU4Y9Br6oHd5bDh0bCpSOixJiWx71YY09J5pM/WEbzFcDmHvwwBu2wnikg+lEj4mwBe5bC5h1OUqcwpdC60dxegRmR06TyjCF9G9z+qM2uCJmuMJmaNZaUrCSIi6X+jJIBBYtW5Cge7cd7sgoHDfDaAvKQGAlRZYc6ltJlMxX03UzlaRlBdQrzSCwksLRbOpHUSb7pcsnxCCwngvM2Rm/ugUCi84fycr4l2t8Bb6iqTxSCgNIAAAAAElFTkSuQmCC';  
var currURL = window.location.toString();  
if (currURL.search ('/stumbler/') != -1) {  
addStumblerControl ();  
} else if (currURL.search ('/stumblers/') != -1) {  
addGroupLists ();  
} else if (currURL.search ('/share/') != -1){  
addShareControl ();  
}  
function addShareControl () {  
var contactlist = document.getElementById ('contactList');  
var i;  
for (i=0; i<groupList.length; i++) {  
var cmd = document.createElement ('a');  
var cmdli = document.createElement ('li');  
cmd.title = groupList[i];  
cmd.href = 'javascript:void(0);';  
cmd.textContent = groupList[i];  
cmd.addEventListener ('click', function () {  
var gr = this.title;  
var members = new Array ();  
var groupgm = GM_getValue (gr).split(',');  
var contactli = contactlist.getElementsByTagName ('li');  
var j, k;  
var count = 0;  
while (groupgm.length > 1) { // first item is empty due to trailing comma in gm var  
members.push(groupgm.shift()); // pairs of usernames and userids  
groupgm.shift();  
}  
for (j=0; j<contactli.length; j++) {  
if (contactli[j].className != 'jdmcmd') {  
var un = contactli[j].textContent.replace (/s/g, '');  
for (k=0; k<members.length; k++) {  
if (un == maxStr (members[k], 10)) {  
contactli[j].className = 'checked';  
contactli[j].childNodes[3].childNodes[1].checked = true;  
count++;  
}  
}  
}  
}  
alert (count+' friends added to selection.');  
}, false);  
cmdli.className = 'jdmcmd';  
cmdli.appendChild (cmd);  
if (i==0) {  
contactlist.insertBefore (cmdli, contactlist.firstChild);  
} else {  
contactlist.insertBefore (cmdli, contactlist.firstChild.nextSibling);  
}  
}  
}  
function addStumblerControl () {  
var sidebar = document.getElementsByClassName ('colRight')[0];  
var uname = document.getElementsByClassName ('headerControls')[0].childNodes[3].childNodes[1].textContent.replace (/s/g, '');  
var id = unsafeWindow.profile_user;  
var groupdiv = document.createElement ('div');  
sidebar.insertBefore (groupdiv, sidebar.firstChild);  
var menuul = document.createElement ('ul');  
var listul = document.createElement ('ul');  
var menuli = document.createElement ('li');  
var menucmd = document.createElement ('a');  
menuli.className = 'hasChild';  
menucmd.href = 'javascript:void(0);';  
menucmd.textContent = 'Friend groups';  
menuli.addEventListener ('mouseover', function () {  
this.className = 'hasChild hover';  
}, false);  
menuli.addEventListener ('mouseout', function () {  
this.className = 'hasChild';  
}, false);  
menuli.appendChild (menucmd);  
menuli.appendChild (listul);  
menuul.appendChild (menuli);  
groupdiv.className = 'filter'; // nasty multiple id botch - guilty as charged  
groupdiv.style.marginBottom = '10px';  
groupdiv.appendChild (menuul);  
for (i=0; i<groupList.length; i++) {  
var itemli = document.createElement ('li');  
var cmd = document.createElement ('a');  
var rspan = document.createElement ('span');  
var rimg = document.createElement ('img');  
cmd.href = 'javascript:void(0);';  
cmd.textContent = groupList[i];  
rspan.className = 'right';  
rimg.src = imgTick;  
rspan.appendChild (rimg);  
cmd.appendChild (rspan);  
if (!isStumblerInGroup (uname, groupList[i])) {  
rimg.style.display = 'none';  
}  
cmd.addEventListener ('click', function () {  
ri = this.childNodes[1].childNodes[0];  
gr = this.textContent;  
if (ri.style.display == 'none') {  
if (numInGroup (gr) < MAXFRIENDS) {  
addStumblerToGroup (uname, id, gr);  
ri.style.display = '';  
} else {  
alert ('Maximum friends per group limit ('+MAXFRIENDS+') reached.');  
}  
} else {  
delStumblerFromGroup (uname, gr);  
ri.style.display = 'none';  
}  
}, false);  
itemli.appendChild (cmd);  
listul.appendChild (itemli);  
}  
}  
function maxStr (str, max) {  
if (str.length > max) {  
return str.substr (0,max-3) + '...';  
} else return str;  
}       
function addGroupLists () {  
var i;  
var sidebar = document.getElementsByClassName ('colRight')[0];  
var groupsdiv = document.createElement ('div');  
var groupsh3 = document.createElement ('h3');  
groupsdiv.className = 'box borderBottom';  
groupsh3.textContent = 'Friend groups';  
groupsdiv.appendChild (groupsh3);  
sidebar.insertBefore (groupsdiv, sidebar.firstChild);  
for (i=0; i<groupList.length; i++) {  
var groupgm = GM_getValue (groupList[i]).split(',');  
var groupdiv = document.createElement ('div');  
var menuul = document.createElement ('ul');  
var listul = document.createElement ('ul');  
var menuli = document.createElement ('li');  
var menucmd = document.createElement ('a');  
var delul = document.createElement ('ul');  
var delli = document.createElement ('li');  
var delcmd = document.createElement ('a');  
var delcmdimg = document.createElement ('img');  
menuli.className = 'hasChild';  
menucmd.href = 'javascript:void(0);';  
menucmd.textContent = groupList[i];  
delcmd.href = 'javascript:void(0);';  
delcmd.title = 'Delete';  
delcmd.addEventListener ('click', function () {  
var gl = 0;  
var pardiv = this.parentNode.parentNode.parentNode;  
if (confirm ('Are you sure you want to delete the '+pardiv.title+' group?')) {  
GM_deleteValue(pardiv.title);  
groupList = GM_listValues (); // refresh list  
pardiv.parentNode.removeChild (pardiv);  
if (groupList.length == MAXGROUPS-1) {  
document.getElementById ('jdmaddgroupdiv').style.display = '';  
}  
}  
}, false);  
delcmdimg.src = imgBin;  
delcmd.appendChild (delcmdimg);  
delli.appendChild (delcmd);  
delul.className = 'right';  
delul.appendChild (delli);  
menuli.addEventListener ('mouseover', function () {  
this.className = 'hasChild hover';  
}, false);  
menuli.addEventListener ('mouseout', function () {  
this.className = 'hasChild';  
}, false);  
menuli.appendChild (menucmd);  
menuli.appendChild (listul);  
menuul.className = 'left';  
menuul.appendChild (menuli);  
groupdiv.className = 'filter'; // nasty multiple id botch - guilty as charged  
groupdiv.style.marginBottom = '10px';  
groupdiv.appendChild (menuul);  
groupdiv.appendChild (delul);  
groupdiv.title = groupList[i];  
groupsdiv.appendChild (groupdiv);  
while (groupgm.length > 1) { // first item is empty due to trailing comma in gm var  
var uname = groupgm.shift(); // pairs of usernames and userids  
var id = groupgm.shift();  
var itemli = document.createElement ('li');  
var cmdleft = document.createElement ('a');  
var text = document.createTextNode (' '+maxStr (uname,10));  
var cmdright = document.createElement ('a');  
var cmdpm = document.createElement ('a');  
var imgcmdpm = document.createElement ('img');  
var imgcmddel = document.createElement ('img');  
var avatar = document.createElement ('img');  
var br = document.createElement ('br');  
cmdleft.href = '/stumbler/'+uname+'/';  
cmdleft.className = 'left';  
cmdleft.style.width = '96px';  
cmdleft.style.padding = '3px 2px 4px';  
cmdleft.title = uname;  
cmdright.href = 'javascript:void(0);';  
cmdright.className = 'right';  
cmdright.style.clear = 'right';  
cmdright.style.padding = '1px 2px';  
imgcmddel.src = imgBin;  
imgcmddel.title = 'Delete';  
cmdright.appendChild (imgcmddel);  
cmdright.name = uname;  
cmdright.addEventListener ('click', function () {  
var gn = this.parentNode.parentNode.parentNode.parentNode.parentNode.title;  
if (confirm ('Delete '+this.name+' from the '+gn+' group?')) {  
delStumblerFromGroup (this.name, gn);  
this.parentNode.parentNode.removeChild (this.parentNode);  
}  
}, false);  
cmdpm.href = '/stumbler/'+uname+'/contact/';  
cmdpm.className = 'right';  
cmdpm.style.clear = 'right';  
cmdpm.style.padding = '1px 2px';  
imgcmdpm.src = imgPM;  
imgcmdpm.title = 'Contact';  
cmdpm.appendChild (imgcmdpm);                 
avatar.src = 'http://cdn.stumble-upon.com/superminipics/'+id+'.jpg';  
avatar.width = '32';  
br.className = 'clear';  
cmdleft.appendChild (avatar);  
cmdleft.appendChild (text);  
itemli.appendChild (cmdleft);  
itemli.appendChild (cmdpm);  
itemli.appendChild (cmdright);  
itemli.appendChild (br);  
listul.appendChild (itemli);  
}  
}  
var addgroupdiv = document.createElement ('div');  
var addgroupname = document.createElement ('input');  
var addgrouph3 = document.createElement ('h3');  
var addgroupcmd = document.createElement ('a');  
addgroupdiv.id = 'jdmaddgroupdiv';  
addgrouph3.textContent = 'Add group';  
addgroupname.id = 'jdmaddgroup';  
addgroupcmd.className = 'btnGreen';  
addgroupcmd.style.padding = '3px 12px;';  
addgroupcmd.style.marginLeft = '5px';  
addgroupcmd.style.display = 'inline-block';  
addgroupcmd.textContent = 'Add';  
addgroupcmd.addEventListener ('click', function () {  
var agn = document.getElementById ('jdmaddgroup');  
if (agn.value !== '') {  
GM_setValue (agn.value, '');  
window.location.reload (false);  
}  
}, false);  
addgroupdiv.appendChild (addgrouph3);  
addgroupdiv.appendChild (addgroupname);  
addgroupdiv.appendChild (addgroupcmd);  
if (groupList.length < MAXGROUPS) {  
addgroupdiv.style.display = '';  
} else {  
addgroupdiv.style.display = 'none';  
}  
groupsdiv.appendChild (addgroupdiv);  
}       
function addStumblerToGroup (uname, id, group) {  
var gmtemp = GM_getValue (group);  
GM_setValue (group, gmtemp+uname+','+id+',');  
}  
function numInGroup (group) {  
return (GM_getValue (group).split (',').length / 2);  
}  
function delStumblerFromGroup (uname, group) {  
var gmtemp = GM_getValue (group);  
var delexp = new RegExp (uname+',[0-9]*,');  
GM_setValue (group, gmtemp.replace (delexp, ''));  
}  
function isStumblerInGroup (uname, group) {  
return (GM_getValue (group).search (uname) != -1);  
}  
CheckScriptForUpdate = {  
id: '67176', // Script id on Userscripts.org  
days: 1, // Days to wait between update checks  
name: ///s*@names+(.*)s*n/i.exec(scr_meta)[1],  
version: ///s*@versions+(.*)s*n/i.exec(scr_meta)[1].replace(/./g, ''),  
time: new Date().getTime(),  
call: function(response) {  
GM_xmlhttpRequest({  
method: 'GET',  
url: 'https://userscripts.org/scripts/source/'+this.id+'.meta.js',  
onload: function(xpr) {AnotherAutoUpdater.compare(xpr,response);}  
});  
},  
compare: function(xpr,response) {  
this.xversion=///s*@versions+(.*)s*n/i.exec(xpr.responseText);  
this.xname=///s*@names+(.*)s*n/i.exec(xpr.responseText);  
if ( (this.xversion) && (this.xname[1] == this.name) ) {  
this.xversion = this.xversion[1].replace(/./g, '');  
this.xname = this.xname[1];  
} else {  
if ( (xpr.responseText.match("the page you requested doesn't exist")) || (this.xname[1] != this.name) )   
GM_setValue('updated_'+this.id, 'off');  
return false;  
}  
if ( (+this.xversion > +this.version) && (confirm('A new version of the '+this.xname+' user script is available. Do you want to update?')) ) {  
GM_setValue('updated_'+this.id, this.time+'');  
top.location.href = 'https://userscripts.org/scripts/source/'+this.id+'.user.js';  
} else if ( (this.xversion) && (+this.xversion > +this.version) ) {  
if(confirm('Do you want to turn off auto updating for this script?')) {  
GM_setValue('updated_'+this.id, 'off');  
GM_registerMenuCommand("Auto Update "+this.name, function(){GM_setValue('updated_'+this.id, new Date().getTime()+''); AnotherAutoUpdater.call(true);});  
alert('Automatic updates can be re-enabled for this script from the User Script Commands submenu.');  
} else {  
GM_setValue('updated_'+this.id, this.time+'');  
}  
} else {  
if(response) alert('No updates available for '+this.name);  
GM_setValue('updated_'+this.id, this.time+'');  
}  
},  
check: function() {  
if (GM_getValue('updated_'+this viagra ou acheter.id, 0) == 0) GM_setValue('updated_'+this.id, this.time+'');  
if ( (GM_getValue('updated_'+this.id, 0) != 'off') && (+this.time > (+GM_getValue('updated_'+this.id, 0) + (1000*60*60*24*this.days))) ) {  
this.call();  
} else if (GM_getValue('updated_'+this.id, 0) == 'off') {  
GM_registerMenuCommand("Enable "+this.name+" updates", function(){GM_setValue('updated_'+this.id, new Date().getTime()+'');AnotherAutoUpdater.call(true);});  
} else {  
GM_registerMenuCommand("Check "+this.name+" for updates", function(){GM_setValue('updated_'+this.id, new Date().getTime()+'');AnotherAutoUpdater.call(true);});  
}  
}  
};  
if (self.location == top.location && typeof GM_xmlhttpRequest != 'undefined') AnotherAutoUpdater.check();  

Hope to update this soon and please join the discussion or let me know what you have to say in the comments below.

New Media Concept Tags: code friends greasemonkey groups javascript stumbleupon userscript

Digg Instant Image Instant Video 1 Click Submit Bookmarklets

Digg Instant Image and Instant Video One Click Submission Bookmarklets

Once upon a time I was a digger and I can remember the biggest pointless headache for those hard to get submissions. Digg has an extension, Digg has a bookmarklet but there is one problem with both. Neither has an option to submit images to digg or submit videos to digg. After my last StumbleUpon Greasemonkey UserScript post I happened upon another good friend and was reminded of it. So of course I whipped out my trusty code snippets and solved the problem.

Now you can submit to Digg faster without breaking the rules and save clicking time while you’re at it. Here are the digg submission tools for one and all.

1 Click Digg Image Submit

The codebase used:

javascript:(function(){window.open('http://digg.com/submit?&amp;media=image&amp;url='+encodeURIComponent(location.href));})();

bookmarklet for digg 1click image submits

To use simply drag the “bookmarklet” link above to your bookmarks bar and click to submit images from any page.

1 Click Digg Video Submit

The codebase used: 

javascript:(function(){window.open('http://digg.com/submit?&amp;amp;video=image&amp;amp;url='+encodeURIComponent(location.href));})();

bookmarklet for digg 1click video submits

To use simply drag the “bookmarklet” link above to your bookmarks bar and click to submit videos from any page.

Hope these are helpful. Let me know if you have any bugs in the comments, have fun.

New Media Concepts Tags: bookmarklet code digg images javascript submission tools video

Reblog this post [with Zemanta]

New Media Tools: Greasemonkey Stumbleupon Extended Friend Groups Script and Stumbleupon Extended Friend Groups Firefox Extension

New Media Tools: Greasemonkey Stumbleupon Extended Friends Groups Userscript Beta and Stumbleupon Extended Friend Groups Firefox Extension Alpha

There is no doubt Stumbleupon is my favorite site to pass my time and explore. It goes without saying Firefox is my go-to browser. Unquestionably do I say Greasemonkey is the simplest way to tweak you code in browser. This is the method to the madness next to follow.
A good friend brought to my attention a cool greasemonkey userscript ‘SU V4 Friend Groups‘ at userscripts.org by Foresthippy for stumbleupon to enhance the experience. Groups, plain and simple, an extra ability to make groups of friends and contact for stumbleupon. Yet we both found the same problem with its limits, so I fixed it. Don’t worry I used real code paste, not ductape. When it is a non beta release I will add to to my userscript profile as well, and now here it is… taaa daaaa????
Greasemonkey Script the.user.js [beta version]
Adds the ability to make up to 48 groups of SU friends with up to 99 in each group.
Firefox Extension the.extension.xpi [alpha version]
Same function as GM script [alpha is unstable, do not install, link is for testing, you have been warned]
Code:

 // ==UserScript==  
 // @name      Stumbleupon Extended Friend Groups  
 // @version            0.9.0  
 // @namespace    http://blog.michde.com  
 // @description   Groups for stumbleupon  
 // @include     http://*.stumbleupon.com/stumblers/*  
 // @include     http://*.stumbleupon.com/stumbler/*  
 // @include     http://*.stumbleupon.com/share/*  
 // @license     Nunyaz  
 // ==/UserScript==  
 var groupList = GM_listValues ();  
 var MAXGROUPS = 48; MAXFRIENDS = 99;  
 var imgBin = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAD9SURBVBgZBcFLLkNRAADQc1/fU6qkhFRMMNIQn8TUQCJWYBE2YBkWYQWMJIZmNuAXCSoGFUGIInJf33VOSAAAAIAcgLOFt3079flaEdTS50M6nT7YeggJwPFle6nhAoVhc370rnaXcwBSp62GTdxoGdPrkAPQD5OSbRFr6oLvjByA53CqY9YUvjy68YQcgELTuTd/khENbQk5ANGqFUSFnq6WW2QA5Op4VuhreJVEZACUAKiJkogMgIEKANFARAZAKQKolColMgA+f7vVkBkRSeYjvf6QAfB1cnnXNWTUhHHrXuLoESEBYO/aYjNUSqX3snk/2DjshwQAAAD4B9GUWR0G4scKAAAAAElFTkSuQmCC';  
 var imgPM = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAITSURBVBgZpcHLThNhGIDh9/vn7/RApwc5VCmFWBPi1mvwAlx7BW69Afeu3bozcSE7E02ILjCRhRrds8AEbKVS2gIdSjvTmf+TYqLu+zyiqszDMCf75PnnnVwhuNcLpwsXk8Q4BYeSOsWpkqrinJI6JXVK6lSRdDq9PO+19vb37XK13Hj0YLMUTVVyWY//Cf8IVwQEGEeJN47S1YdPo4npDpNmnDh5udOh1YsZRcph39EaONpnjs65oxsqvZEyTaHdj3n2psPpKDLBcuOOGUWpZDOG+q0S7751ObuYUisJGQ98T/Ct4Fuo5IX+MGZr95jKjRKLlSxXxFxOEmaaN4us1Upsf+1yGk5ZKhp8C74H5ZwwCGO2drssLZZo1ouIcs2MJikz1oPmapHlaoFXH1oMwphyTghyQj+MefG+RblcoLlaJG/5y4zGCTMikEwTctaxXq/w9kuXdm9Cuzfh9acujXqFwE8xmuBb/hCwl1GKAnGccDwIadQCfD9DZ5Dj494QA2w2qtQW84wmMZ1eyFI1QBVQwV5GiaZOpdsPaSwH5HMZULi9UmB9pYAAouBQbMHHrgQcnQwZV/KgTu1o8PMgipONu2t5KeaNiEkxgAiICDMCCFeEK5aNauAOfoXx8KR9ZOOLk8P7j7er2WBhwWY9sdbDeIJnwBjBWBBAhGsCmiZxPD4/7Z98b/0QVWUehjkZ5vQb/Un5e/DIsVsAAAAASUVORK5CYII=';  
 var imgTick = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGrSURBVDjLvZPZLkNhFIV75zjvYm7VGFNCqoZUJ+roKUUpjRuqp61Wq0NKDMelGGqOxBSUIBKXWtWGZxAvobr8lWjChRgSF//dv9be+9trCwAI/vIE/26gXmviW5bqnb8yUK028qZjPfoPWEj4Ku5HBspgAz941IXZeze8N1bottSo8BTZviVWrEh546EO03EXpuJOdG63otJbjBKHkEp/Ml6yNYYzpuezWL4s5VMtT8acCMQcb5XL3eJE8VgBlR7BeMGW9Z4yT9y1CeyucuhdTGDxfftaBO7G4L+zg91UocxVmCiy51NpiP3n2treUPujL8xhOjYOzZYsQWANyRYlU4Y9Br6oHd5bDh0bCpSOixJiWx71YY09J5pM/WEbzFcDmHvwwBu2wnikg+lEj4mwBe5bC5h1OUqcwpdC60dxegRmR06TyjCF9G9z+qM2uCJmuMJmaNZaUrCSIi6X+jJIBBYtW5Cge7cd7sgoHDfDaAvKQGAlRZYc6ltJlMxX03UzlaRlBdQrzSCwksLRbOpHUSb7pcsnxCCwngvM2Rm/ugUCi84fycr4l2t8Bb6iqTxSCgNIAAAAAElFTkSuQmCC';  
 var currURL = window.location.toString();  
 if (currURL.search ('/stumbler/') != -1) {  
      addStumblerControl ();  
 } else if (currURL.search ('/stumblers/') != -1) {  
      addGroupLists ();  
 } else if (currURL.search ('/share/') != -1){  
      addShareControl ();  
 }  
 function addShareControl () {  
      var contactlist = document.getElementById ('contactList');  
      var i;  
      for (i=0; i<groupList.length; i++) {  
           var cmd = document.createElement ('a');  
           var cmdli = document.createElement ('li');  
           cmd.title = groupList[i];  
           cmd.href = 'javascript:void(0);';  
           cmd.textContent = groupList[i];  
           cmd.addEventListener ('click', function () {  
                var gr = this.title;  
                var members = new Array ();  
                var groupgm = GM_getValue (gr).split(',');  
                var contactli = contactlist.getElementsByTagName ('li');  
                var j, k;  
                var count = 0;  
                while (groupgm.length > 1) { // first item is empty due to trailing comma in gm var  
                     members.push(groupgm.shift()); // pairs of usernames and userids  
                     groupgm.shift();  
                }  
                for (j=0; j<contactli.length; j++) {  
                     if (contactli[j].className != 'jdmcmd') {  
                          var un = contactli[j].textContent.replace (/s/g, '');  
                          for (k=0; k<members.length; k++) {  
                               if (un == maxStr (members[k], 10)) {  
                                    contactli[j].className = 'checked';  
                                    contactli[j].childNodes[3].childNodes[1].checked = true;  
                                    count++;  
                               }  
                          }  
                     }  
                }  
                alert (count+' friends added to selection.');  
           }, false);  
           cmdli.className = 'jdmcmd';  
           cmdli.appendChild (cmd);  
           if (i==0) {  
                contactlist.insertBefore (cmdli, contactlist.firstChild);  
           } else {  
                contactlist.insertBefore (cmdli, contactlist.firstChild.nextSibling);  
           }  
      }  
 }  
 function addStumblerControl () {  
      var sidebar = document.getElementsByClassName ('colRight')[0];  
      var uname = document.getElementsByClassName ('headerControls')[0].childNodes[3].childNodes[1].textContent.replace (/s/g, '');  
      var id = unsafeWindow.profile_user;  
      var groupdiv = document.createElement ('div');  
      sidebar.insertBefore (groupdiv, sidebar.firstChild);  
      var menuul = document.createElement ('ul');  
      var listul = document.createElement ('ul');  
      var menuli = document.createElement ('li');  
      var menucmd = document.createElement ('a');  
      menuli.className = 'hasChild';  
      menucmd.href = 'javascript:void(0);';  
      menucmd.textContent = 'Friend groups';  
      menuli.addEventListener ('mouseover', function () {  
           this.className = 'hasChild hover';  
      }, false);  
      menuli.addEventListener ('mouseout', function () {  
           this.className = 'hasChild';  
      }, false);  
      menuli.appendChild (menucmd);  
      menuli.appendChild (listul);  
      menuul.appendChild (menuli);  
      groupdiv.className = 'filter'; // nasty multiple id botch - guilty as charged  
      groupdiv.style.marginBottom = '10px';  
      groupdiv.appendChild (menuul);  
      for (i=0; i<groupList.length; i++) {  
           var itemli = document.createElement ('li');  
           var cmd = document.createElement ('a');  
           var rspan = document.createElement ('span');  
           var rimg = document.createElement ('img');  
           cmd.href = 'javascript:void(0);';  
           cmd.textContent = groupList[i];  
           rspan.className = 'right';  
           rimg.src = imgTick;  
           rspan.appendChild (rimg);  
           cmd.appendChild (rspan);  
           if (!isStumblerInGroup (uname, groupList[i])) {  
                rimg.style.display = 'none';  
           }  
           cmd.addEventListener ('click', function () {  
                ri = this.childNodes[1].childNodes[0];  
                gr = this.textContent;  
                if (ri.style.display == 'none') {  
                     if (numInGroup (gr) < MAXFRIENDS) {  
                          addStumblerToGroup (uname, id, gr);  
                          ri.style.display = '';  
                     } else {  
                          alert ('Maximum friends per group limit ('+MAXFRIENDS+') reached.');  
                     }  
                } else {  
                     delStumblerFromGroup (uname, gr);  
                     ri.style.display = 'none';  
                }  
           }, false);  
           itemli.appendChild (cmd);  
           listul.appendChild (itemli);  
      }  
 }  
 function maxStr (str, max) {  
      if (str.length > max) {  
           return str.substr (0,max-3) + '...';  
      } else return str;  
 }       
 function addGroupLists () {  
      var i;  
      var sidebar = document.getElementsByClassName ('colRight')[0];  
      var groupsdiv = document.createElement ('div');  
      var groupsh3 = document.createElement ('h3');  
      groupsdiv.className = 'box borderBottom';  
      groupsh3.textContent = 'Friend groups';  
      groupsdiv.appendChild (groupsh3);  
      sidebar.insertBefore (groupsdiv, sidebar.firstChild);  
      for (i=0; i<groupList.length; i++) {  
           var groupgm = GM_getValue (groupList[i]).split(',');  
           var groupdiv = document.createElement ('div');  
           var menuul = document.createElement ('ul');  
           var listul = document.createElement ('ul');  
           var menuli = document.createElement ('li');  
           var menucmd = document.createElement ('a');  
           var delul = document.createElement ('ul');  
           var delli = document.createElement ('li');  
           var delcmd = document.createElement ('a');  
           var delcmdimg = document.createElement ('img');  
           menuli.className = 'hasChild';  
           menucmd.href = 'javascript:void(0);';  
           menucmd.textContent = groupList[i];  
           delcmd.href = 'javascript:void(0);';  
           delcmd.title = 'Delete';  
           delcmd.addEventListener ('click', function () {  
                var gl = 0;  
                var pardiv = this.parentNode.parentNode.parentNode;  
                if (confirm ('Are you sure you want to delete the '+pardiv.title+' group?')) {  
                     GM_deleteValue(pardiv.title);  
                     groupList = GM_listValues (); // refresh list  
                     pardiv.parentNode.removeChild (pardiv);  
                     if (groupList.length == MAXGROUPS-1) {  
                          document.getElementById ('jdmaddgroupdiv').style.display = '';  
                     }  
                }  
           }, false);  
           delcmdimg.src = imgBin;  
           delcmd.appendChild (delcmdimg);  
           delli.appendChild (delcmd);  
           delul.className = 'right';  
           delul.appendChild (delli);  
           menuli.addEventListener ('mouseover', function () {  
                this.className = 'hasChild hover';  
           }, false);  
           menuli.addEventListener ('mouseout', function () {  
                this.className = 'hasChild';  
           }, false);  
           menuli.appendChild (menucmd);  
           menuli.appendChild (listul);  
           menuul.className = 'left';  
           menuul.appendChild (menuli);  
           groupdiv.className = 'filter'; // nasty multiple id botch - guilty as charged  
           groupdiv.style.marginBottom = '10px';  
           groupdiv.appendChild (menuul);  
           groupdiv.appendChild (delul);  
           groupdiv.title = groupList[i];  
           groupsdiv.appendChild (groupdiv);  
           while (groupgm.length > 1) { // first item is empty due to trailing comma in gm var  
                var uname = groupgm.shift(); // pairs of usernames and userids  
                var id = groupgm.shift();  
                var itemli = document.createElement ('li');  
                var cmdleft = document.createElement ('a');  
                var text = document.createTextNode (' '+maxStr (uname,10));  
                var cmdright = document.createElement ('a');  
                var cmdpm = document.createElement ('a');  
                var imgcmdpm = document.createElement ('img');  
                var imgcmddel = document.createElement ('img');  
                var avatar = document.createElement ('img');  
                var br = document.createElement ('br');  
                cmdleft.href = '/stumbler/'+uname+'/';  
                cmdleft.className = 'left';  
                cmdleft.style.width = '96px';  
                cmdleft.style.padding = '3px 2px 4px';  
                cmdleft.title = uname;  
                cmdright.href = 'javascript:void(0);';  
                cmdright.className = 'right';  
                cmdright.style.clear = 'right';  
                cmdright.style.padding = '1px 2px';  
                imgcmddel.src = imgBin;  
                imgcmddel.title = 'Delete';  
                cmdright.appendChild (imgcmddel);  
                cmdright.name = uname;  
                cmdright.addEventListener ('click', function () {  
                     var gn = this.parentNode.parentNode.parentNode.parentNode.parentNode.title;  
                     if (confirm ('Delete '+this.name+' from the '+gn+' group?')) {  
                          delStumblerFromGroup (this.name, gn);  
                          this.parentNode.parentNode.removeChild (this.parentNode);  
                     }  
                }, false);  
                cmdpm.href = '/stumbler/'+uname+'/contact/';  
                cmdpm.className = 'right';  
                cmdpm.style.clear = 'right';  
                cmdpm.style.padding = '1px 2px';  
                imgcmdpm.src = imgPM;  
                imgcmdpm.title = 'Contact';  
                cmdpm.appendChild (imgcmdpm);                 
                avatar.src = 'http://cdn.stumble-upon.com/superminipics/'+id+'.jpg';  
                avatar.width = '32';  
                br.className = 'clear';  
                cmdleft.appendChild (avatar);  
                cmdleft.appendChild (text);  
                itemli.appendChild (cmdleft);  
                itemli.appendChild (cmdpm);  
                itemli.appendChild (cmdright);  
                itemli.appendChild (br);  
                listul.appendChild (itemli);  
           }  
      }  
      var addgroupdiv = document.createElement ('div');  
      var addgroupname = document.createElement ('input');  
      var addgrouph3 = document.createElement ('h3');  
      var addgroupcmd = document.createElement ('a');  
      addgroupdiv.id = 'jdmaddgroupdiv';  
      addgrouph3.textContent = 'Add group';  
      addgroupname.id = 'jdmaddgroup';  
      addgroupcmd.className = 'btnGreen';  
      addgroupcmd.style.padding = '3px 12px;';  
      addgroupcmd.style.marginLeft = '5px';  
      addgroupcmd.style.display = 'inline-block';  
      addgroupcmd.textContent = 'Add';  
      addgroupcmd.addEventListener ('click', function () {  
           var agn = document.getElementById ('jdmaddgroup');  
           if (agn.value !== '') {  
                GM_setValue (agn.value, '');  
                window.location.reload (false);  
           }  
      }, false);  
      addgroupdiv.appendChild (addgrouph3);  
      addgroupdiv.appendChild (addgroupname);  
      addgroupdiv.appendChild (addgroupcmd);  
      if (groupList.length < MAXGROUPS) {  
           addgroupdiv.style.display = '';  
      } else {  
           addgroupdiv.style.display = 'none';  
      }  
      groupsdiv.appendChild (addgroupdiv);  
 }       
 function addStumblerToGroup (uname, id, group) {  
      var gmtemp = GM_getValue (group);  
      GM_setValue (group, gmtemp+uname+','+id+',');  
 }  
 function numInGroup (group) {  
      return (GM_getValue (group).split (',').length / 2);  
 }  
 function delStumblerFromGroup (uname, group) {  
      var gmtemp = GM_getValue (group);  
      var delexp = new RegExp (uname+',[0-9]*,');  
      GM_setValue (group, gmtemp.replace (delexp, ''));  
 }  
 function isStumblerInGroup (uname, group) {  
      return (GM_getValue (group).search (uname) != -1);  
 }  

You can find me on Stumble Upon all the time to. Come say hi and show me what you found to 🙂
New Media Tagged: extension firefox greasemonkey stumbleupon userscript

New Media Tools Text Word Counter

Simple Text Word Counter

function countit(){

/*Word count script
By JavaScript Kit (http://javascriptkit.com)
Over 400+ free scripts here!
*/

var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(” “)
document.wordcount.wordcount3.value=formcontent.length
}

This free script provided by
JavaScript
Kit

Many time I have needed a word count, now we have a quick tool for it. Hope its as helpful for you as it was to me.

Hat Tip to http://JavaScriptKit.com for the source code.

New Media Tools Text Character Counter

Simple Text Character Counter

This free script provided by
JavaScript
Kit

function countit(what){

//Character count script- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use

formcontent=what.form.charcount.value
what.form.displaycount.value=formcontent.length
}

Many time I have needed a character count, now we have a quick tool for it. Hope its as helpful for you as it was to me.

Hat Tip to http://JavaScriptKit.com for the source code.

New Media Concepts Digg API / CompleteList

Digg API / CompleteList: “Alphabetical List of Endpoints”

Digg API Alphabetical List of Endpoints

/containers (List Containers)
/container/{container short_name} (List Containers)
/errors (List Errors)
/error/{code} (List Errors)
/galleryphotos (List Gallery Photos)
/galleryphotos/comments (List Gallery Photos)
/galleryphoto/{id} (List Gallery Photos)
/galleryphoto/{id}/comments (List Gallery Photos)
/galleryphoto/{id}/comment/{id} (List Gallery Photos)
/galleryphoto/{id}/comment/{id}/replies (List Gallery Photos)
/galleryphotos/{list} (List Gallery Photos)
/galleryphotos/{list}/comments (List Gallery Photos)
/media (List Media)
/medium/{medium short_name} (List Media)
/stories (List Stories)
/stories/{comma-separated list of story ids} (List Stories)
/stories/{comma-separated list of story ids}/comments (List Events)
/stories/{comma-separated list of story ids}/diggs (List Events)
/stories/comments (List Events)
/stories/container/{container name} (List Stories)
/stories/container/{container name}/hot (List Stories)
/stories/container/{container name}/popular (List Stories)
/stories/container/{container name}/top (List Stories)
/stories/container/{container name}/upcoming (List Stories)
/stories/diggs (List Events)
/stories/hot (List Stories)
/stories/popular (List Stories)
/stories/popular/comments (List Events)
/stories/popular/diggs (List Events)
/stories/top (List Stories)
/stories/topic/{topic name} (List Stories)
/stories/topic/{topic name}/hot (List Stories)
/stories/topic/{topic name}/popular (List Stories)
/stories/topic/{topic name}/top (List Stories)
/stories/topic/{topic name}/upcoming (List Stories)
/stories/upcoming (List Stories)
/stories/upcoming/comments (List Events)
/stories/upcoming/diggs (List Events)
/story/{story clean title} (List Stories)
/story/{story id} (List Stories)
/story/{story id}/activity (Activity, deprecated)
/story/{story id}/activity/comments (Activity, deprecated)
/story/{story id}/activity/diggs (Activity, deprecated)
/story/{story id}/comments (List Events)
/story/{story id}/diggs (List Events)
/story/{story id}/comment/{comment id} (List Events)
/story/{story id}/comment/{comment id}/replies (List Events)
/story/{story id}/user/{user name}/digg (List Events)
/topics (List Topics)
/topic/{topic short_name} (List Topics)
/user/{user name} (List Users)
/user/{user name}/activity (Activity, deprecated)
/user/{user name}/activity/comments (Activity, deprecated)
/user/{user name}/activity/diggs (Activity, deprecated)
/user/{user name}/commented (List Stories)
/user/{user name}/comments (List Events)
/user/{user name}/diggs (List Events)
/user/{user name}/dugg (List Stories)
/user/{user name}/fan/{fan user name} (List Users)
/user/{user name}/fans (List Users)
/user/{user name}/friend/{friend user name} (List Users)
/user/{user name}/friends (List Users)
/user/{user name}/friends/commented (List Stories)
/user/{user name}/friends/dugg (List Stories)
/user/{user name}/friends/commented (List Stories)
/user/{user name}/friends/popular (List Stories)
/user/{user name}/friends/submissions (List Stories)
/user/{user name}/friends/upcoming (List Stories)
/user/{user name}/popular (List Stories)
/user/{user name}/submissions (List Stories)
/user/{user name}/upcoming (List Stories)
/users (List Users)
/users/{comma-separated list of user names} (List Users)
/users/{comma-separated list of user names}/comments (List Events)
/users/{comma-separated list of user names}/diggs (List Events)