Permalink
Browse files

Linked up the user.

  • Loading branch information...
1 parent 0c995d6 commit 0fff8bcd31dfb0cdbbd207e02cd97b3613abd27c @jeffrock jeffrock committed Jan 15, 2012
Showing with 16 additions and 3 deletions.
  1. +15 −2 end.js
  2. +1 −1 global.html
View
17 end.js
@@ -3,14 +3,27 @@ $.fn.outerHTML = function() {
};
function getMediaID(theMessageEvent) {
- if (theMessageEvent.name === "theMediaID") {
- var mediaID = theMessageEvent.message;
+ if (theMessageEvent.name === "theInstagramData") {
+ var mediaID = theMessageEvent.message.media_id;
+ var authorID = theMessageEvent.message.author_id
// Link the photo with the URL scheme
var currentPhotoHTML = $('img.photo:first').outerHTML();
var newPhotoHTML = '<a href=\"x-mobelux-carousel://openmedia?mediaID=' + mediaID + '\" title=\"View photo in Carousel\">' + currentPhotoHTML + '</a>';
$('img.photo:first').replaceWith(newPhotoHTML);
+ // Get username and link with the URL scheme
+ var usernameElement = $('.username:first');
+ var usernameText = usernameElement.text();
+ var currentAuthorNameHTML = usernameElement.outerHTML();
+ var newAuthorNameHTML = '<a href=\"x-mobelux-carousel://openuser?userID=' + authorID + '\" title=\"View ' + usernameText + ' in Carousel\">' + currentAuthorNameHTML + '</a>';
+ usernameElement.replaceWith(newAuthorNameHTML);
+ //alert(currentAuthorNameHTML);
+
+ // Link the author avatar with the URL scheme
+ var currentAuthorHTML = $('img.profile-picture:first').outerHTML();
+ var newAuthorHTML = '<a href=\"x-mobelux-carousel://openuser?userID=' + authorID + '\" title=\"View ' + usernameText + ' in Carousel\">' + currentAuthorHTML + '</a>';
+ $('img.profile-picture:first').replaceWith(newAuthorHTML);
}
}
View
@@ -17,7 +17,7 @@
$.getJSON(apiURL,
function (data) {
// Send media id to injected script
- safari.application.activeBrowserWindow.activeTab.page.dispatchMessage("theMediaID", data.media_id);
+ safari.application.activeBrowserWindow.activeTab.page.dispatchMessage("theInstagramData", data);
});
}

0 comments on commit 0fff8bc

Please sign in to comment.