This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLabelSphere.xml
More file actions
87 lines (84 loc) · 6.09 KB
/
LabelSphere.xml
File metadata and controls
87 lines (84 loc) · 6.09 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?xml version="1.0" encoding="UTF-8" ?>
<!--
LabelSphere.xml - Displays Blogger labels in a rotating sphere shape.
Copyright (C) 2010, 2011 Alex Dioso (alex.dioso@ikaika.org)
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 3 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<Module>
<ModulePrefs title="Label Sphere"
title_url="http://blog.ikaika.org/search/label/Gadget"
description="Displays the most recent labels of a blog in a movable
sphere. This gadget is written in JavaScript, no flash required.
Your blog must be public for this gadget to work. The feed used for
the labels updates slowly so recently created labels will take time to
show up."
author="Alex Dioso"
author_email="alex.dioso@ikaika.org"
thumbnail="http://alexdioso.github.com/LabelSphere/LabelSphereThumbnail.png"
screenshot="http://alexdioso.github.com/LabelSphere/LabelSphereScreenshot.png"
author_location="Seattle, Washington, US"
author_affiliation="ikaika.org" >
<Require feature="opensocial-0.8"/>
<Require feature="google.blog"/>
<Require feature="skins"/>
<Require feature="minimessage"/>
</ModulePrefs>
<UserPref name="maxLabels"
display_name="Maximum number of labels"
default_value="20"/>
<!--
JavaScript optimized for Closure Compiler
http://code.google.com/closure/compiler/docs/gettingstarted_app.html
-->
<Content type="html">
<}function H(){$(this)[A]({opacity:".5",fontSize:"70%"},"fast")}function I(a){if(a.text=="User does not have permission to read this blog.")t("This gadget only works on public blogs");else{var c;a:{c=a.data.feed.link;for(var f in c)if(c[f].rel=="alternate"){c=c[f].href;break a}c=void 0}if(typeof c=="undefined")t("Error getting Website URL");else{J(a,c);if(q){K();n.dismissMessage(B);L();M()}else t("No Labels")}}}function t(a){n.dismissMessage(B);
n.createStaticMessage(a)}function J(a,c){var f=a.data.feed.entry;for(var e in f){var d=f[e].category;for(var i in d){if(q>=u)break;var h=d[i].term;if(b.hasOwnProperty(h))b[h].c++;else{$(j).append('<div id="'+h+'" class="ikaikaLabel" style="position:absolute;border-width:1"><a href="'+c+"search/label/"+h+'" target="_parent">'+h+"</a></div>");b[h]={};b[h].c=1;q++}}}$("a")[l]({color:o("CONTENT_LINK_COLOR"),textDecoration:"none"});$(".ikaikaLabel")[v](function(){$(this)[l]({borderStyle:"solid"})},function(){$(this)[l]({borderStyle:"none"})})}
function K(){k=$(j)[w]>$(j)[x]?$(j)[x]():$(j)[w]();p=k*3/11;k=k/2-1;var a=Math.PI*(3-y(5)),c=2/q;$(".ikaikaLabel").each(function(f,e){var d=$(e)[N]("id");b[d].b=e;b[d].y=f*c-1+c/2;var i=y(1-b[d].y*b[d].y),h=f*a;b[d].x=C(h)*i;b[d].a=D(h)*i;E(b[d],0,0)})}function E(a){var c=a.y*p+k,f=a.a*p+k,e=a.x*p,d=(a.x+1)/4*100+50,i=d/100;$(a.b)[l]({fontSize:d+"%"});c-=$(a.b)[w]()/2;f-=$(a.b)[x]()/2;$(a.b)[l]({bottom:f,right:c,zIndex:Math.round(e)});$(a.b).fadeTo(0,i)}function L(){$(j).mousemove(function(a){var c=
$(j).offset(),f=a.pageX-c.left-k;a=k-(a.pageY-c.top);c=y(f*f+a*a);m=Math.atan2(c,p)/15;g.x=0;g.y=a/c;g.a=f/c})}function M(){$(j)[v](function(){r=0;s=setTimeout(z,33)},function(){r=1})}function z(){var a=C(m),c=1-a,f=D(m);for(var e in b){var d={},i={};i.x=g.y*b[e].a-g.a*b[e].y;i.y=g.a*b[e].x-g.x*b[e].a;i.a=g.x*b[e].y-g.y*b[e].x;var h=g.x*b[e].x+g.y*b[e].y+g.a*b[e].a;d.x=b[e].x*a;d.x+=i.x*f;d.x+=g.x*h*c;d.y=b[e].y*a;d.y+=i.y*f;d.y+=g.y*h*c;d.a=b[e].a*a;d.a+=i.a*f;d.a+=g.a*h*c;b[e].x=d.x;b[e].y=d.y;
b[e].a=d.a;E(b[e])}if(r){m-=m/20;if(m<0.01){r=0;clearTimeout(s)}else s=setTimeout(z,33)}else s=setTimeout(z,33)}var y=Math.sqrt,D=Math.sin,C=Math.cos,O=new gadgets.Prefs,l="css",v="hover",A="animate",w="width",x="height",N="attr",j,k,q=0,b={},p,s,r=0,m,g={},o=gadgets.skins.getProperty,P=o("FONT_FACE"),n=new gadgets.MiniMessage(F);if(google.hasOwnProperty("Blog")){var B=n.createStaticMessage("Loading..."),u=parseInt(O.getString("maxLabels"),10);if(isNaN(u))u=20;google.load("jquery","1");google.setOnLoadCallback(function(){j=
$("#ikaika-container");$("*")[l]({backgroundColor:o("CONTENT_BG_COLOR"),color:o("CONTENT_LINK_COLOR"),fontFamily:P});$(j)[l]({borderColor:o("BORDER_COLOR")});$("#ikaika")[v](G,H);var a=new google.Blog(function(){a.getPostsJson(I)},window.name)})}else n.createStaticMessage("Label Sphere only works in Blogger")};
gadgets.util.registerOnLoadHandler(function(){
ikaika(__MODULE_ID__)
});
</script>
<style type="text/css">
#ikaika-container {
overflow: hidden;
width: 100%;
height: 100%;
z-index: -99;
border-style: solid;
border-width: 1px;
}
#ikaika {
position: absolute;
bottom: 0px;
/* TODO - Fix opacity for IE
* http://www.quirksmode.org/css/opacity.html
*/
opacity: .5;
font-size: 70%;
}
</style>
<div id="ikaika-container">
<div id="ikaika">
<a href="http://blog.ikaika.org/search/label/Gadget"
target="_parent">ikaika.org</a>
</div>
</div>
]]>
</Content>
</Module>
<!-- vim: set filetype=google_gadgets : -->