Again about Browser Shots plugin

Jan 192015
 
 Posted by on 19/01/2015 How-To's Tagged with: ,  Add comments

Fortunately Ben Gillbanks observed the problems and released version 1.3.1. Still are 2 minor issues in the new version and I mentioned them on WordPress forum. Until Ben will come back from holiday, can replace those 2 variables in the plugin js file or can use my js file from the end of this post.

Few days ago I wrote an article about Browser Shots plugin which was updated with necessary features but the update break the Visual Editor. As Ben Gillbanks promised, he took care of the problem and yesterday he updated the plugin to fix the Visual Editor.

More than that, he took out the ugly javascript alert boxes, and replace them with a nice pop-up for setting the plugin parameters. Also, a nice addition (even if is not documented in any way), is that you can set a caption for the image by writing the text in the editor, then select the words and press the Browser Shots button.

browser-shots-pop-up

Unfortunately… the pop-up still not works as expected… It add the same shortcode as the old version. Even if in pop-up you can add a custom height and a custom link, they are never used. Instead only the link to the image and its width is used to generate the shortcode.

Why? About the link… is simple – a textbox for link is added in pop-up, but its value is never used later in the code. And the height is used like this:

Here is a logical glitch, if “width” exist (and probably this is always true), the else clause is not read and settled “height” is never used. This could be fine if the default height would be settled as “auto”, but no, the default height is 450px and because cannot be settled in the pop-up will have to overwrite manually this value.

So, again, inspired by the new code added by Ben, I corrected it and I added fields to define all parameters for the shortcode, including tooltips for helping people to set these parameters.

 The whole code (including the definitions for new fields in pop-up) can be downloaded from here: Download the new version of Browser Shots js file

Unzip the file and copy it by ftp under /plugins/browser-shots/js/, overwriting the original file.  After that, clear your browser cache.  I spent hours trying to figure out why my changes aren’t executed until I found that my browser still execute the original file.

 

https://drafie-design.nl/again-about-browser-shots-plugin/trackback/Trackback URI:  

Ciprian

Experienced web developer and graphic designer. Former consultant for Suffusion theme and former moderator on Suffusion Support forum. I teach others while learning myself.

Google+ Profile

    Google+ Page

 Leave a Reply

(Your comment will be published. To contact me privately, use the contact form.)

This site uses Akismet to reduce spam. Learn how your comment data is processed.