summaryrefslogtreecommitdiff
path: root/gstudio/static/gstudio/js/diasporaSyndicate.js
blob: e6242c868d1d5df9504bdba141c9bf0db80ec657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

function hasProt(s)
{
	var re=/^\b(https?):\/\//i;
	return re.test(s);
};

function getPodName()
{
	var _1=localStorage.getItem("diasporapodname");
	{
	    
		_1=prompt("Enter your Diaspora pod...","");
		if(_1==""||_1==null)
		{
			alert("Pod name is empty or invalid!");
			return;
		}
		else
		{
			if(hasProt(_1))
			{
				_1=_1.replace(/(https?):\/\//,"");
			}
			localStorage.setItem("diasporapodname",_1);
		}
	}
    shareOnD(_1);
};

function shareOnD(_2)
{
    f="https://"+_2+"/bookmarklet?url="+encodeURIComponent(window.location.href)+"&title="+encodeURIComponent(document.title)+"&notes="+encodeURIComponent(""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text)+document.getElementById("diasporacontent").value)+"&v=1&";
	a=function()
	{	
		if(!window.open(f+"noui=1&jump=doclose","diasporav1","location=yes,links=no,scrollbars=no,toolbar=no,width=620,height=350"))
		{
			location.href=f+"jump=yes";
		}
	};
	if(/Firefox/.test(navigator.userAgent))
	{
		setTimeout(a,0);
	}
	else
	{
		a();
	}
};

window.onload=function()
{       var _3=document.getElementById("asterisk").src;
	var _4=document.getElementById("R-button");
	_4.innerHTML="";
	var R=Raphael("R-button",44,44);
	R.circle(22,22,20).attr({fill:"r(.5,.10)#ccc-#aaa","fill-opacity":0.3,"stroke-width":3});
	var _5=R.image(_3,9,9,26,26);
	var _6=null,_7=0;
	_4.onmouseover=function()
			{
				_7+=180;
				_5.animate({transform:"r"+_7},5000,"backOut");
			};
	_4.onmouseout=function()
			{	
				_7+=180;
				_5.animate({transform:"r"+_7},5000,"elastic");
			};
	_4.onclick=function()
			{
				getPodName();
			};
};