blogthis!

devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
I have been thinking about doing this for awhile, so I went and did it...wrote a very quick interface to Blogspot....

addEvent(window, "load", addBlogLinks());

function addBlogLinks()
{
  var sClassName = document.body.className;
  var re1 = /singleImage /;
  var re2 = /loggedIn /;

  if (re1.test(sClassName) && re2.test(sClassName))
  {
     var objParent = document.getElementById('imageInfo');
     var objChild = document.createElement("a");
     var objText = document.createTextNode("blogthis!");
     objParent.appendChild(objChild);
     objChild.appendChild(objText);
     objChild.setAttribute("href", "javascript:BlogThis();")
  }

}

function BlogThis() 
{
  var imageLink = "";
  var imageHead = "";
  imageLink = "<img border=0 src=\"" + document.getElementById('mainPhoto').src + "\"/>";
  imageHead = document.getElementById('caption_top').firstChild.nodeValue;

  x=document;
  y=window;
  popw = y.open('http://www.blogger.com/blog_this.pyra?t=' + escape(imageLink) + '&u=' + '&n=' +  escape(imageHead),'bloggerForm','scrollbars=no,width=475,height=300,top=175,left=75,status=yes,resizable=yes');
  void(0);
}
So when you are logged in and displaying a singleImage page, a blogthis! link should appear in the ImageInfo box. Automatically picks up the image url (currently being view small,medium, large) and the image caption...probably won't work for pro accounts yet.

Could be some bugs, kinda late here :D


David
David Parry
SmugMug API Developer
My Photos

Comments

  • AndyAndy Registered Users Posts: 50,016 Major grins
    edited January 24, 2006
    devbobo wrote:
    I have been thinking about doing this for awhile, so I went and did it...wrote a very quick interface to Blogspot....


    Could be some bugs, kinda late here :D


    David

    Hey, interesting. Why would't it work for pro accounts? ear.gif
    And, how about Wordpress?
  • devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited January 24, 2006
    Andy wrote:
    Hey, interesting. Why would't it work for pro accounts? ear.gif
    And, how about Wordpress?

    Andy,

    it's not a matter of it never working, but I haven't added to got to grab the copyprotected url.

    yeah, i might look at Wordpress. This was a very quick hack, more proof of concept and would be better suited if I wrote it from scratch and didn't use blogger's pop-up window.

    David
    David Parry
    SmugMug API Developer
    My Photos
  • RhuarcRhuarc Registered Users Posts: 1,464 Major grins
    edited January 27, 2006
    If you could do a version for Wordpress that would be awesome!
Sign In or Register to comment.