Skip to content
Browse files

wip make inline images into background images

  • Loading branch information...
1 parent a896ec2 commit 897556119c757187b596474356a0e89b0ac7f45e @heymatthenry committed
Showing with 20 additions and 1 deletion.
  1. +18 −0 app/toura/components/FeedItemDetail.js
  2. +2 −1 demos/kitchensink/assets/feeds/techcrunch.yml
View
18 app/toura/components/FeedItemDetail.js
@@ -1,8 +1,10 @@
dojo.provide('toura.components.FeedItemDetail');
+dojo.require('mulberry.ui.BackgroundImage');
dojo.require('mulberry._Component');
dojo.require('toura.components.VideoPlayer');
dojo.require('dojo.date.locale');
+dojo.require('dojo.NodeList-manipulate');
dojo.declare('toura.components.FeedItemDetail', mulberry._Component, {
templateString : dojo.cache('toura.components', 'FeedItemDetail/FeedItemDetail.haml'),
@@ -71,6 +73,7 @@ dojo.declare('toura.components.FeedItemDetail', mulberry._Component, {
dojo.attr(this.externalLink, 'href', this.item.link);
+ this._prepareImages();
this._setupLinks();
if (this.region) {
@@ -78,6 +81,21 @@ dojo.declare('toura.components.FeedItemDetail', mulberry._Component, {
}
},
+ _prepareImages : function() {
+ dojo.forEach(this.domNode.querySelectorAll('img'), function(image){
+ dojo.query(image)
+ .wrap("<div class='replacedImage' dojotype=mulberry.ui.BackgroundImage imageUrl="+image.src+"></div>");
+
+ image.parentNode.removeChild(image);
+ }, this);
+
+ dojo.forEach(this.domNode.querySelectorAll('.replacedImage'), function(node){
+ var bgImg = new mulberry.ui.BackgroundImage(node);
+ console.log(bgImg);
+ bgImg.loadImage();
+ }, this);
+ },
+
_setupLinks : function() {
dojo.forEach(this.domNode.querySelectorAll('.content a'), function(link) {
dojo.attr(link, 'target', '_blank');
View
3 demos/kitchensink/assets/feeds/techcrunch.yml
@@ -1 +1,2 @@
-feed_url: http://techcrunch.com/feed
+feed_url: http://insidescoopsf.sfgate.com/blog/section/jon-bonne/feed/
+#feed_url: http://feeds.sfgate.com/sfgate/rss/feeds/giants

0 comments on commit 8975561

Please sign in to comment.
Something went wrong with that request. Please try again.