hs.graphicsDir = '/blog/wp-content/plugins/wordpress-flickr-manager/images/graphics/'; hs.outlineType = 'rounded-white'; function prepareWFMImages() { wfmJS('a[rel*=flickr-mgr]').each(function() { this.onclick= function() { return expandImage(this); }; }); } hs.updateAnchors = function() { var els = document.all || document.getElementsByTagName('*'), all = [], images = [],groups = {}, re; wfmJS('a[rel*=flickr-mgr]').each(function() { all.push(this); images.push(this); var gID = wfmJS(this).attr('rel').match(/flickr\-mgr\[\w*\]/g); var g = (gID) ? 'g' + gID.toString().match(/\[\w*\]/) : 'none'; if (!groups[g]) groups[g] = []; groups[g].push(this); }); for (var i = 0; i < els.length; i++) { re = hs.isHsAnchor(els[i]); if (re) { hs.push(all, els[i]); if (re[0] == 'hs.expand') hs.push(images, els[i]); var g = hs.getParam(els[i], 'slideshowGroup') || 'none'; if (!groups[g]) groups[g] = []; hs.push(groups[g], els[i]); } } hs.anchors = { all: all, groups: groups, images: images }; return hs.anchors; }; function expandImage(anchor) { var save_url = wfmJS(anchor).attr("href"); var caption = wfmJS(anchor).attr('title'); if('' == 'true') caption = wfmJS(anchor).attr('title') + ' '; hs.captionText = caption; var image = wfmJS(anchor).children('img'); var testClass = (image.attr("class") != '') ? image.attr("class") : 'flickr-medium'; if(testClass.match("flickr-original")) { wfmJS(anchor).attr('href', image.attr('longdesc')); } else { var image_link = image.attr('src'); var testResult = (testClass.match(/flickr\-small|flickr\-medium|flickr\-large/)).toString(); var imageSize = ''; if(testResult == 'flickr-large') imageSize = "_b"; else if(testResult == 'flickr-small') imageSize = "_m"; if(image_link.match(/[s,t,m]\.jpg/)) { image_link = image_link.split("_"); image_link.pop(); image_link[image_link.length - 1] = image_link[image_link.length - 1] + imageSize + ".jpg"; image_link = image_link.join("_"); } else if(!image_link.match(/b\.jpg/)) { image_link = image_link.split("."); image_link.pop(); image_link[image_link.length - 1] = image_link[image_link.length - 1] + imageSize + ".jpg"; image_link = image_link.join("."); } wfmJS(anchor).attr('href', image_link); } var gID = wfmJS(anchor).attr('rel').match(/flickr\-mgr\[\w*\]/g); var save_return = false; if(gID) { gID = gID.toString().match(/\[\w*\]/).toString(); save_return = hs.expand(anchor, { slideshowGroup: 'g' + gID }); } else save_return = hs.expand(anchor); wfmJS('#wfm-controlbar').css('display', 'block'); wfmJS(anchor).attr('href', save_url); return save_return; } /* * INSERTS CODE INTO MEDIA TAB MENU SIMILAR TO: *
*/ function addControlbar() { var controlBar = wfmJS(''); var previousButton = wfmJS(''); controlBar.append(previousButton); var nextButton = wfmJS(''); controlBar.append(nextButton); var moveButton = wfmJS(''); controlBar.append(moveButton); var closeButton = wfmJS(''); controlBar.append(closeButton); jQuery('body').append(jQuery('').append(controlBar)); } var wfmJS = jQuery.noConflict(); wfmJS(document).ready(function() { addControlbar(); hs.registerOverlay({ thumbnailId: null, overlayId: 'wfm-controlbar', position: 'top right', hideOnMouseOut: true }); prepareWFMImages(); wfmJS('div#wfm-controlbar').css('display', 'none'); });