RePlurk

By maxchu Last update Jul 16, 2009 — Installed 8,338 times. Daily Installs: 19, 18, 23, 20, 21, 54, 31, 16, 13, 14, 34, 29, 44, 71, 22, 27, 15, 18, 9, 32, 31, 13, 20, 11, 12, 18, 40, 14, 11, 7, 11, 11

There are 6 previous versions of this script.

// ==UserScript==
// @name           RePlurk
// @namespace      http://maxchu.blogspot.com
// @description    RePlurk (version 0.2.1)
// @include        http://www.plurk.com/*
// @exclude        http://www.plurk.com/_comet/*
// @exclude        http://www.plurk.com/User/*
// @exclude        http://www.plurk.com/i18n/*
// ==/UserScript==

// RePlurk (http://userscripts.org/scripts/show/39186)
// version 0.2.1
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html

// == History ==
// 2009-07-16 V0.2.1: add some exclude URLs
// 2009-01-15 V0.2: fixed bug and use jquery 1.3 min version
// 2009-01-09 V0.1.1: fixed bug and make replurk message shorter
// 2008-12-25 V0.1: first version

// == Add jquery == //

var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);

function GM_wait() {
	if(typeof unsafeWindow.jQuery == 'undefined') {
		setTimeout(GM_wait,100);
	} else {
		$ = unsafeWindow.jQuery.noConflict(true);
	}
}

GM_wait();

var uw = unsafeWindow;
var p = uw.Plurks;
var o_expand;

if(p) {
	o_expand = p.expand;
	p.expand = function(div) {
		o_expand(div);

		var ib = $('#input_big').get(0);

		if(ib) {

			var plurk = uw.getPD(div).obj;
			var link = 'http://plurk.com/p/' + (plurk.plurk_id).toString(36);
			var raw = plurk.content_raw;
			var owner_id = plurk.owner_id;

			var info_box = $(uw.$dp.info_box);
			var pp = info_box.children(".perma_link");

			if(info_box.children("#RePlurk").length == 0) {
				var rp = $('<a href="#" id="RePlurk">RePlurk</a>').css('float','right').css('right-padding','3px').click(function(){
					doRePlurk(owner_id,raw,link);
				});

				pp.after(rp);
			}

		}
	}
}


function doRePlurk(owner_id,raw,link){
	var nick = uw.SiteState.getUserById(owner_id).nick_name;

	$('#input_big').val(link + ' ([ReP]) ' + ((nick) ? ('@' + nick + ': ') : '') + raw);
	p._removeExpand();
	uw.MaxChar.updateBig();
}