// __revver_plugin_path = "http://www.bartamaha.com/blog/wp-content/plugins/revver"; __revver_plugin_path = "/blog/wp-content/plugins/revver/"; __revver_flash_width = 480; __revver_flash_height = 392; __revver_flash_logo = ""; __revver_flash_logo_uri = ""; __revver_flash_allowfullscreen = ("yes" == "yes") ? true : false; __revver_flash_logo_updategrab = ("yes" == "yes") ? true : false; __revver_share_displayshare = ("yes" == "yes") ? true : false; __revver_share_displaydetails = ("yes" == "yes") ? true : false; __revver_videos = []; // this will store video object responses from the api. (prevents dup calls on the same page for the same video) __revver_video_posts = []; if (__revver_flash_logo_updategrab) { switch (__revver_flash_logo) { case "unbranded": __revver_flash_logo_uri = "unbranded"; break; case "custom": break; default: __revver_flash_logo_uri = ""; __revver_flash_logo_updategrab = false; break; } } function showVideoDetails(post_id, video_id) { var objectId = "p" + post_id + "v" + video_id; // get the panel objects var detailsPanel = document.getElementById("revver-video-details-panel-" + objectId); var sharePanel = document.getElementById("revver-video-share-panel-" + objectId); // get the panel control buttons var detailsBtn = document.getElementById("revver-video-details-btn-" + objectId); var shareBtn = document.getElementById("revver-video-share-btn-" + objectId); // turn off the share panel and the button if (__revver_share_displayshare) { shareBtn.src = __revver_plugin_path + "/img/share_closed.gif"; sharePanel.style.display = "none"; } getRevverVideoFromApi(post_id, video_id); // toggle the details panel if (detailsPanel.style.display == "block") { detailsBtn.src = __revver_plugin_path + "/img/details_closed.gif"; detailsPanel.style.display = "none"; } else { detailsBtn.src = __revver_plugin_path + "/img/details_opened.gif"; detailsPanel.style.display = "block"; } } function showVideoShare(post_id, video_id) { var objectId = "p" + post_id + "v" + video_id; // get the panel objects var detailsPanel = document.getElementById("revver-video-details-panel-" + objectId); var sharePanel = document.getElementById("revver-video-share-panel-" + objectId); // get the panel control buttons var detailsBtn = document.getElementById("revver-video-details-btn-" + objectId); var shareBtn = document.getElementById("revver-video-share-btn-" + objectId); // turn off the details panel and the button if (__revver_share_displaydetails) { detailsBtn.src = __revver_plugin_path + "/img/details_closed.gif"; detailsPanel.style.display = "none"; } getRevverVideoFromApi(post_id, video_id); // toggle the share panel if (sharePanel.style.display == "block") { shareBtn.src = __revver_plugin_path + "/img/share_closed.gif"; sharePanel.style.display = "none"; } else { shareBtn.src = __revver_plugin_path + "/img/share_opened.gif"; sharePanel.style.display = "block"; } } function showVideoShareSend(post_id, video_id) { var objectId = "p" + post_id + "v" + video_id; // get the panel objects var sendPanel = document.getElementById("revver-video-share-send-" + objectId); var grabPanel = document.getElementById("revver-video-share-grab-" + objectId); grabPanel.style.display = "none"; sendPanel.style.display = "block"; } function showVideoShareGrab(post_id, video_id) { var objectId = "p" + post_id + "v" + video_id; // get the panel objects var sendPanel = document.getElementById("revver-video-share-send-" + objectId); var grabPanel = document.getElementById("revver-video-share-grab-" + objectId); sendPanel.style.display = "none"; grabPanel.style.display = "block"; } function getRevverVideoFromApi(post_id, video_id) { if (!__revver_video_posts[video_id]) __revver_video_posts[video_id] = []; var postLength = __revver_video_posts[video_id].length; __revver_video_posts[video_id][postLength] = post_id; if (!__revver_videos[video_id]) { var _package = {}; var methodParams = [ {"ids" : [video_id]}, ['id','title','owner','author','status','ageRestriction','publicationDate','modifiedDate','url','quicktimeMediaUrl','quicktimeJsUrl','flashMediaUrl','flashJsUrl','thumbnailUrl','description','keywords','duration','size','credits','views','affiliateId'], {"offset": 0, "limit": 1, "count": false, "affiliate": "BARTAMAHA"} ]; _package.params = "method=open.video.find"; _package.params += "&callback=handleRevverVideoReturn"; _package.params += "¶ms=" + REVVER.util.toJSONString.object(methodParams); _package.elementId = "revverJsonApiCall-" + video_id; var jsonRequestObj = new REVVER.util.jsonRequest(_package); jsonRequestObj.send(); jsonRequestObj = null; } else { updateRevverPanels(video_id); } } function handleRevverVideoReturn(json) { if (!json[0]) return; var video_id = json[0]["id"]; __revver_videos[video_id] = json[0]; updateRevverPanels(video_id); } function updateRevverPanels(video_id) { var post_id; for (var i = 0; i < __revver_video_posts[video_id].length; i++) { post_id = __revver_video_posts[video_id][i]; updateRevverDetailsPanel(post_id, video_id); updateRevverSharePanel(post_id, video_id); } } function updateRevverDetailsPanel(post_id, video_id) { var objectId = "p" + post_id + "v" + video_id; var desc = document.getElementById("revver-video-details-desc-" + objectId); var tags = document.getElementById("revver-video-details-tags-" + objectId); var credits = document.getElementById("revver-video-details-credits-" + objectId); var website = document.getElementById("revver-video-details-website-" + objectId); if (!__revver_videos[video_id]) { desc.innerHTML = "Error loading video data from Revver."; return; } desc.innerHTML = __revver_videos[video_id]["description"]; tags.innerHTML = __revver_videos[video_id]["keywords"].join(", "); credits.innerHTML = __revver_videos[video_id]["credits"]; website.innerHTML = __revver_videos[video_id]["url"]; // hide the credits and/or website elements if they are empty if ( __revver_videos[video_id]["credits"] == '' ) { credits.parentNode.style.display = "none"; } else { credits.parentNode.style.display = "block"; } if ( __revver_videos[video_id]["url"] == '' || __revver_videos[video_id]["url"] == 'http://' ) { website.parentNode.style.display = "none"; } else { website.parentNode.style.display = "block"; } var myUrl = __revver_videos[video_id]["url"]; if ( myUrl.indexOf('http') != 0 ) myUrl = "http://" + __revver_videos[video_id]["url"]; website.href = myUrl; } function updateRevverSharePanel(post_id, video_id) { var objectId = "p" + post_id + "v" + video_id; var grab = document.getElementById("revver-video-share-grabcode-" + objectId); if (__revver_flash_logo_updategrab) { grab.value = '
'; } else { grab.value = '
'; } } function updateRevverGrabFormat(selectBox, post_id, video_id) { var format = selectBox[selectBox.selectedIndex].value; var objectId = "p" + post_id + "v" + video_id; var grab = document.getElementById("revver-video-share-grabcode-" + objectId); var randomId = "revver" + objectId + (new Date()).getTime() + Math.floor(Math.random()*20000); switch (format) { case "quicktime": grab.value = '