From: Tomas Sedovic <[email protected]>
Not for regular use yet. This displays the Red Hat news from the Twitter feed
while replacing the old Deltacloud news.
---
deltacloud.org/content/index.haml | 7 +-
deltacloud.org/content/jquery.twit/MIT-LICENSE.txt | 25 ++++
.../content/jquery.twit/jquery.twit.0.2.0.css | 48 ++++++
.../content/jquery.twit/jquery.twit.0.2.0.js | 152 ++++++++++++++++++++
.../content/jquery.twit/jquery.twit.0.2.0.min.js | 24 +++
deltacloud.org/content/styles/firstpage.css | 24 +++-
deltacloud.org/layouts/default.txt | 8 +
7 files changed, 276 insertions(+), 12 deletions(-)
create mode 100644 deltacloud.org/content/jquery.twit/MIT-LICENSE.txt
create mode 100644 deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.css
create mode 100644 deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.js
create mode 100644 deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.min.js
create mode 100644 deltacloud.org/content/jquery.twit/version.txt
diff --git a/deltacloud.org/content/index.haml
b/deltacloud.org/content/index.haml
index 066110b..34a086c 100644
--- a/deltacloud.org/content/index.haml
+++ b/deltacloud.org/content/index.haml
@@ -46,12 +46,7 @@ filter: haml
providers to add their cloud to the Deltacloud common API.
#news
.recent
- %h2
- News
- %ul
- - all_news.each do |item|
- %li
- = item
+
%br
%br
.section.video{ :style => "margin-top:16px;" }
diff --git a/deltacloud.org/content/jquery.twit/MIT-LICENSE.txt
b/deltacloud.org/content/jquery.twit/MIT-LICENSE.txt
new file mode 100644
index 0000000..f0f2ba9
--- /dev/null
+++ b/deltacloud.org/content/jquery.twit/MIT-LICENSE.txt
@@ -0,0 +1,25 @@
+Copyright (c) 2009 Paul Bakaus, http://jqueryui.com/
+
+This software consists of voluntary contributions made by many
+individuals (AUTHORS.txt, http://jqueryui.com/about) For exact
+contribution history, see the revision history and logs, available
+at http://jquery-ui.googlecode.com/svn/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.css
b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.css
new file mode 100644
index 0000000..7ad6708
--- /dev/null
+++ b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.css
@@ -0,0 +1,48 @@
+/** Twit **/
+.twit {
+ background-color: #cbf2ff;
+ padding: 7px;
+}
+.twitHeader {
+ background-color: #fff;
+ margin: 0;
+ padding: 7px 7px 0 7px;
+}
+.twitLabel {
+ font-weight: bold;
+ font-size: 22px;
+ color: #33ccff;
+}
+.twitTitle {
+ font-weight: bold;
+}
+.twitUser {
+ background-color: #fff;
+ border-bottom: none;
+ font-size:160%;
+ padding: 7px;
+}
+.twitUser a{
+ color:#222;
+ font-weight:bold;
+ text-decoration: none;
+}
+.twitBody {
+ background-color: #ffffff;
+ padding: 0 7px 7px 7px;
+ margin: 0;
+ list-style: none;
+}
+.twitEntry {
+ padding: 6px 8px;
+ margin: 0;
+ border-bottom: dashed 1px #ccc;
+ height: auto !important;
+}
+.twitNavi {
+ clear: both;
+ text-align: center;
+ margin-top: 0;
+ padding: 5px;
+ background-color: #ffffff;
+}
diff --git a/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.js
b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.js
new file mode 100644
index 0000000..4120dc1
--- /dev/null
+++ b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.js
@@ -0,0 +1,152 @@
+/**
+ * Twit
+ * jQuery Plugin to Display Twitter Tweets on a Blog.
+ * http://code.google.com/p/jquery-twit/
+ *
+ * Copyright (c) 2010 Yusuke Horie
+ *
+ * Released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * Since : 0.1.0 - 08/26/2009
+ * Version: 0.2.0 - 02/17/2010
+ */
+(function(jQuery){
+
+ var _i = 0;
+
+ /** public methods **/
+
+ jQuery.fn.twit = function (user, options) {
+ if (typeof user != 'string') return this;
+
+ var
+ opts = jQuery.extend({}, jQuery.fn.twit.defaults, options),
+ c = jQuery.isFunction(opts.callback) ? opts.callback: _callback,
+ url = 'http://twitter.com/statuses/user_timeline/' + user + '.json',
+ params = {};
+
+ opts.user = user;
+ params.count = opts.count;
+
+ return this.each(function(i, e) {
+ var $e = $(e);
+ if (!$e.hasClass('twit')) $e.addClass('twit');
+
+ jQuery.ajax({
+ url: url,
+ data: params,
+ dataType: 'jsonp',
+ success: function (o) {
+ c.apply(this, [(o.results) ? o.results: o, e, opts]);
+ }
+ });
+ });
+ };
+
+ jQuery.fn.twit.defaults = {
+ user: null,
+ callback: null,
+ icon: true,
+ username: true,
+ text: true,
+ count: 200,
+ limit: 7,
+ label: 'Twitter',
+ title: ''
+ };
+
+ /** private method **/
+
+ var _callback = function (o, e, opts) {
+ var $this = $(e);
+ if (!o || o.length == 0 || $this.length == 0) return false;
+ $this.data('_inc', 1);
+ _i++;
+
+ var username = o[0].user.screen_name,
+ icon = o[0].user.profile_image_url;
+
+ var h =
+ '<div class="twitHeader">' +
+ ' <span class="twitLabel">' + opts.label + '</span> ' +
+ ' <span class="twitTitle">' + opts.title + '</span>' +
+ '</div>';
+ if (opts.icon || opts.username) {
+ h += '<div class="twitUser">';
+ if (opts.icon)
+ h +=
+ ' <a href="http://twitter.com/' + username + '/">' +
+ ' <img src="' + icon + '" alt="' + username + '" title="' +
username + '" style="vertical-align:middle;" />' +
+ ' </a> ';
+ if (opts.username)
+ h += '<a href="http://twitter.com/' + username + '/">' + username +
'</a>';
+ h += '</div>';
+ }
+ h += '<ul class="twitBody" id="twitList' + _i + '">' + _build(o, $this,
opts) + '</ul>';
+
+ $this.html(h);
+
+ $('a.twitEntryShow', '#twitList' + _i).live('click', function (e) {
+ e.preventDefault();
+ var $t = $(this);
+
+ $t.parent().fadeOut(400, function () {
+ var i = $this.data('_inc');
+ i++;
+ $this.data('_inc', i);
+
+ if ($t.hasClass('twitEntryAll')) {
+ $t.die('click');
+ var start = (i*opts.limit) - opts.limit;
+ $(this).after(_build(o, $this, opts, start, o.length)).remove();
+ } else {
+ $(this).after(_build(o, $this, opts)).remove();
+ }
+ });
+ });
+
+ };
+
+ var _build = function (o, $t, opts, s, e) {
+ var
+ h = '',
+ inc = $t.data('_inc'),
+ start = s || (inc*opts.limit) - opts.limit,
+ end = e || ((o.length > start + opts.limit) ? start + opts.limit:
o.length);
+
+ for (var i=start; i<end; i++) {
+ var
+ t = o[i],
+ username = t.user.screen_name,
+ icon = t.user.profile_image_url;
+
+ h += '<li class="twitEntry">';
+ if (opts.text) {
+ var text = t.text
+ .replace(/(https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/,
function (u) {
+ var shortUrl = (u.length > 30) ? u.substr(0, 30) + '...': u;
+ return '<a href="' + u + '">' + shortUrl + '</a>';
+ })
+ .replace(/@([a-zA-Z0-9_]+)/g, '@<a
href="http://twitter.com/$1">$1</a>')
+ .replace(/(?:^|\s)#([^\s\.\+:!]+)/g, function (a, u) {
+ return ' <a href="http://twitter.com/search?q=' +
encodeURIComponent(u) + '">#' + u + '</a>';
+ });
+ h += ' <span>' + text + '</span>';
+ }
+
+ h += '</li>';
+ }
+
+ if (o.length > end) {
+ h +=
+ '<li class="twitNavi">' +
+ '<a href="#" class="twitEntryShow">more</a> / ';
+ if (o.length > opts.limit)
+ h += '<a href="#" class="twitEntryShow twitEntryAll">all</a>';
+ h += '</li>';
+ }
+ return h;
+ };
+
+})(jQuery);
diff --git a/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.min.js
b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.min.js
new file mode 100644
index 0000000..110cdf6
--- /dev/null
+++ b/deltacloud.org/content/jquery.twit/jquery.twit.0.2.0.min.js
@@ -0,0 +1,24 @@
+/**
+ * Twit
+ * jQuery Plugin to Display Twitter Tweets on a Blog.
+ * http://code.google.com/p/jquery-twit/
+ *
+ * Copyright (c) 2010 Yusuke Horie
+ *
+ * Released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * Since : 0.1.0 - 08/26/2009
+ * Version: 0.2.0 - 02/17/2010
+ */
+(function(jQuery){var _i=0;jQuery.fn.twit=function(user,options){if(typeof
user!='string')return this;var
+opts=jQuery.extend({},jQuery.fn.twit.defaults,options),c=jQuery.isFunction(opts.callback)?opts.callback:_callback,url='http://twitter.com/statuses/user_timeline/'+user+'.json',params={};opts.user=user;params.count=opts.count;return
this.each(function(i,e){var
$e=$(e);if(!$e.hasClass('twit'))$e.addClass('twit');jQuery.ajax({url:url,data:params,dataType:'jsonp',success:function(o){c.apply(this,[(o.results)?o.results:o,e,opts]);}});});};jQuery.fn.twit.defaults={user:null,callback:null,icon:true,username:true,text:true,count:200,limit:7,label:'Twitter',title:''};var
_callback=function(o,e,opts){var
$this=$(e);if(!o||o.length==0||$this.length==0)return
false;$this.data('_inc',1);_i++;var
username=o[0].user.screen_name,icon=o[0].user.profile_image_url;var h='<div
class="twitHeader">'+' <span class="twitLabel">'+opts.label+'</span> '+' <span
class="twitTitle">'+opts.title+'</span>'+'</div>';if(opts.icon||opts.username){h+='<div
class="twitUser">';if(opts.icon)
+h+=' <a href="http://twitter.com/'+username+'/">'+' <img src="'+icon+'"
alt="'+username+'" title="'+username+'" style="vertical-align:middle;" />'+'
</a> ';if(opts.username)
+h+='<a href="http://twitter.com/'+username+'/">'+username+'</a>';h+='</div>';}
+h+='<ul class="twitBody"
id="twitList'+_i+'">'+_build(o,$this,opts)+'</ul>';$this.html(h);$('a.twitEntryShow','#twitList'+_i).live('click',function(e){e.preventDefault();var
$t=$(this);$t.parent().fadeOut(400,function(){var
i=$this.data('_inc');i++;$this.data('_inc',i);if($t.hasClass('twitEntryAll')){$t.die('click');var
start=(i*opts.limit)-opts.limit;$(this).after(_build(o,$this,opts,start,o.length)).remove();}else{$(this).after(_build(o,$this,opts)).remove();}});});};var
_build=function(o,$t,opts,s,e){var
+h='',inc=$t.data('_inc'),start=s||(inc*opts.limit)-opts.limit,end=e||((o.length>start+opts.limit)?start+opts.limit:o.length);for(var
i=start;i<end;i++){var
+t=o[i],username=t.user.screen_name,icon=t.user.profile_image_url;h+='<li
class="twitEntry">';if(opts.text){var
text=t.text.replace(/(https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/,function(u){var
shortUrl=(u.length>30)?u.substr(0,30)+'...':u;return'<a
href="'+u+'">'+shortUrl+'</a>';}).replace(/@([a-zA-Z0-9_]+)/g,'@<a
href="http://twitter.com/$1">$1</a>').replace(/(?:^|\s)#([^\s\.\+:!]+)/g,function(a,u){return'
<a
href="http://twitter.com/search?q='+encodeURIComponent(u)+'">#'+u+'</a>';});h+='
<span>'+text+'</span>';}
+h+='</li>';}
+if(o.length>end){h+='<li class="twitNavi">'+'<a href="#"
class="twitEntryShow">more</a> / ';if(o.length>opts.limit)
+h+='<a href="#" class="twitEntryShow twitEntryAll">all</a>';h+='</li>';}
+return h;};})(jQuery);
\ No newline at end of file
diff --git a/deltacloud.org/content/jquery.twit/version.txt
b/deltacloud.org/content/jquery.twit/version.txt
new file mode 100644
index 0000000..e69de29
diff --git a/deltacloud.org/content/styles/firstpage.css
b/deltacloud.org/content/styles/firstpage.css
index fc25d1e..786cf52 100644
--- a/deltacloud.org/content/styles/firstpage.css
+++ b/deltacloud.org/content/styles/firstpage.css
@@ -60,12 +60,6 @@ than the rest of the site */
line-height: 30px;
}
-#news h2 {
- border-bottom:none;
- color:#cc0000;
- margin-top: 0;
-}
-
#news ul {
margin-left:15px;
@@ -94,6 +88,24 @@ than the rest of the site */
-webkit-border-radius: 10px;
}
+#news .twitUser {
+ display: none;
+}
+
+#news .twitHeader .twitLabel {
+ border-bottom:none;
+ color:#cc0000;
+ margin-top: 0;
+}
+
+#news li.twitEntry {
+ border-bottom: none !important;
+}
+
+#news .twitNavi {
+ display: none;
+}
+
#news .section {
background-color:transparent;
margin-bottom: 2em;
diff --git a/deltacloud.org/layouts/default.txt
b/deltacloud.org/layouts/default.txt
index 00a0402..3fac780 100644
--- a/deltacloud.org/layouts/default.txt
+++ b/deltacloud.org/layouts/default.txt
@@ -18,9 +18,11 @@ filter: haml
- if @page.filename == "index"
%link{ :href => "./styles/firstpage.css", :rel => "stylesheet", :type =>
"text/css" }
%link{ :href => "./jquery.fancybox/jquery.fancybox-1.3.1.css", :rel =>
"stylesheet", :type => "text/css", :media => "screen" }
+ %link{ :href => "./jquery.twit/jquery.twit.0.2.0.css", :rel =>
"stylesheet", :type => "text/css", :media => "screen" }
%script{ :type => "text/javascript", :src =>
"./jquery.fancybox/jquery-1.3.2.min.js" }
%script{ :type => "text/javascript", :src =>
"./jquery.fancybox/jquery.easing-1.3.pack.js" }
%script{ :type => "text/javascript", :src =>
"./jquery.fancybox/jquery.fancybox-1.3.1.pack.js" }
+ %script{ :type => "text/javascript", :src =>
"./jquery.twit/jquery.twit.0.2.0.min.js" }
%script{ :src => "Scripts/swfobject_modified.js", :type =>
"text/javascript" }
%script{ :type => "text/javascript" }
$(document).ready(function() {
@@ -32,6 +34,12 @@ filter: haml
$("a.providers").fancybox({ 'hideOnContentClick': true, 'padding': 0,
'margin': 0, 'width': 958,
'height': 528, 'scrolling': 'no', 'autoDimensions': false,
'autoScale': true });
}
+ $("#news .recent").twit("redhatnews", {
+ count: 10,
+ limit: 4,
+ label: "News",
+ icon: false
+ });
});
--
1.7.1.1
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel