NEW: "Action - Mouse Click - Image - Open" option. You can click an image to open it in new tab/window.

This commit is contained in:
attosoft committed 2012-08-11 04:36:05 +00:00
1 parent f7518c7d23
commit 2ada5e6e39
6 files changed
+21 -12

No files matched your search

+4 -2
View File
@@ -137,7 +137,7 @@ class auto_thickbox_options {
}
function action_metabox() {
$click_end_disabled = in_array($this->options['click_img'], array('close', 'none'));
$click_end_disabled = !in_array($this->options['click_img'], array('next', 'prev_next'));
$click_range_disabled = $this->options['click_img'] != 'prev_next';
?>
<table class="form-table">
@@ -153,6 +153,8 @@ class auto_thickbox_options {
<?php echo $this->texts['next2']; ?></label>
<label class="item"><input type="radio" name="auto-thickbox-plus[click_img]" value="prev_next"<?php $this->util->checked($this->options['click_img'], 'prev_next'); ?> onclick="disableClickOption(this)" />
<?php echo "{$this->texts['prev2']} / {$this->texts['next2']}"; ?></label>
<label class="item"><input type="radio" name="auto-thickbox-plus[click_img]" value="open"<?php $this->util->checked($this->options['click_img'], 'open'); ?> onclick="disableClickOption(this)" />
<?php echo $this->texts['open']; ?></label>
</td>
</tr>
<tr>
@@ -758,7 +760,7 @@ class auto_thickbox_options {
?>
<table class="form-table">
<tr>
<th scope="row"><?php echo ucfirst($this->util->_s('Open', 'open')); ?></th>
<th scope="row"><?php echo $this->texts['open']; ?></th>
<td>
<label class="item"><input type="radio" name="auto-thickbox-plus[effect_open]" value="zoom"<?php $this->util->checked($this->options['effect_open'], 'zoom'); ?> />
<?php $this->util->_e('Zoom'); ?></label>
+1 -1
View File
@@ -106,7 +106,7 @@ function disablePlaceOption(checkbox) {
}
function disableClickOption(radio) {
var disabled = radio.value == "close" || radio.value == "none";
var disabled = radio.value != "next" && radio.value != "prev_next";
for (var i = 0; i < document.form['auto-thickbox-plus[click_end]'].length; i++)
document.form['auto-thickbox-plus[click_end]'][i].disabled = disabled;
+2
View File
@@ -146,6 +146,7 @@ class auto_thickbox {
'image' => $this->texts['image'],
'of' => $this->texts['of'],
'close' => $this->texts['close'],
'open' => $this->texts['open'],
'noiframes' => $this->util->__('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
'loadingAnimation' => $this->options['img_load'] != 'none' ? $this->options['img_load'] : $this->options_def['img_load'],
'closeImage' => $this->options['img_close_btn'] != 'none' ? $this->options['img_close_btn'] : $this->options_def['img_close_btn']
@@ -782,6 +783,7 @@ SCRIPT;
$this->texts['content_etc'] = $this->util->__('Content, Excerpt, Comments, Widgets');
if ($this->texts['content_etc'] == 'Content, Excerpt, Comments, Widgets')
$this->texts['content_etc'] = __('Content') . ', ' . __('Excerpt') . ', ' . $this->util->_s('Comments', 'Comment') . ', ' . __('Widgets');
$this->texts['open'] = ucfirst($this->util->_s('Open', 'open'));
}
} # auto_thickbox
+5 -2
View File
@@ -65,7 +65,7 @@ Any comments will be very helpful and appreciated. Thank you for your support!
* Dutch (nl_NL) translation - [Michel Bats](http://www.batssoft.nl/)
* French (fr_FR) translation - [Jean-Bastien Prévots](http://www.jbprevots.fr/)
* Italian (it_IT) translation - [Gianni Diurno](http://gidibao.net/)
* Persian/Farsi (fa_IR) translation - [Mohammadi](http://www.NewModel.ir/)
* Persian/Farsi (fa_IR) translation - [Ali Mohammadi](http://www.NewModel.ir/)
* Spanish (es_ES) translation - [Juan Antonio Peón](http://www.aprendeausartumovil.com/)
* Button images in screenshot - [Lukas Häusler](http://lukashausler.com/)
* Bug fixed code - Olivier Burgard
@@ -273,7 +273,10 @@ You can localize the plugin with [Poedit](http://www.poedit.net/). All you do is
== Changelog ==
= Latest Version =
* NEW: "Action - Mouse Click - Image - Open" option. You can click an image to open it in new tab/window.
* NEW: "View - Size - Window (Content) - Width/Height" option. You can change the default size of ThickBox window with non-image, and it can be overridden with `width`/`height` parameters in URL.
* CHANGED: Uses spinner controls (input:number) instead of text fields (input:text) in options for entering numerical values. input:number is introduced in HTML5 so now it works only at Google Chrome, Opera and Safari.
* FIXED: "Mouse Wheel" actions do not work in Firefox since some time
* UPDATED: Added *Italian (it_IT) translation (props Gianni Diurno)*
= 1.7 =
@@ -292,7 +295,7 @@ You can localize the plugin with [Poedit](http://www.poedit.net/). All you do is
* FIXED: Improved Right-to-Left (RTL) support in Options page when using Persian and so on
* FIXED: Workaround for the issue that Media Uploader does not work in WordPress 3.3.3 or later
* FIXED: 'First'/'Last' are not translated in ThickBox window because WordPress translations are split into locale.pot and admin-locale.pot since WordPress 3.4. So 'First'/'Last' had translated only in Options page.
* UPDATED: Added **Persian/Farsi (fa_IR) translation (props Mohammadi)** and **Spanish (props Juan Antonio Peón)** translation, and updated French translation (props JB Prévots) and Japanese translation
* UPDATED: Added **Persian/Farsi (fa_IR) translation (props Mohammadi)** and **Spanish (es_ES) translation (props Juan Antonio Peón)**, and updated French translation (props JB Prévots) and Japanese translation
= 1.6 =
* NEW: "General - Display Style - Set a different gallery-id for each WordPress Gallery" option. You can use "Gallery Images" style in WordPress Gallery even when using "Single Image" style.
+2
View File
@@ -213,6 +213,8 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
TB_Image = "<img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/>";
if (tb_options.click_img == "close" || (!imageGroup && tb_options.click_end == "close"))
TB_Image = "<a href='' id='TB_ImageOff' title='"+thickboxL10n.close+"'>" + TB_Image + "</a>";
else if (tb_options.click_img == "open")
TB_Image = "<a href='"+url+"' target='_blank' title='"+thickboxL10n.open+"'>" + TB_Image + "</a>";
TB_Caption = "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><img src='" + tb_closeImage + "' /></a></div>";
if (tb_options.effect_cap != 'none')
TB_Caption = "<div id='TB_CaptionBar'>" + TB_Caption + "</div>";
+7 -7
View File
@@ -9,13 +9,13 @@ function tb_show(a,c,b){try{"undefined"===typeof document.body.style.maxHeight?(
2);jQuery("#TB_load").show();var d=c;-1!==c.indexOf("?")&&(d=c.substr(0,c.indexOf("?")));-1!==c.indexOf("#")&&(d=c.substr(0,c.indexOf("#")));var e=/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$|\.webp$|\.pdf$/,k=d.toLowerCase().match(e);if(".jpg"==k||".jpeg"==k||".png"==k||".gif"==k||".bmp"==k||".webp"==k){TB_imageCount=TB_NextHTML=TB_NextURL=TB_NextCaption=TB_PrevHTML=TB_PrevURL=TB_PrevCaption="";TB_FoundURL=!1;TB_LastURL=TB_LastCaption=TB_FirstURL=TB_FirstCaption="";if(b){TB_TempArray=jQuery("a[rel="+b+"]").get();
for(TB_Counter=0;TB_Counter<TB_TempArray.length&&""===TB_NextHTML;TB_Counter++)TB_TempArray[TB_Counter].href.toLowerCase().match(e),("object"==typeof a?TB_TempArray[TB_Counter]!=a:TB_TempArray[TB_Counter].href!=c)?TB_FoundURL?(TB_NextCaption=TB_TempArray[TB_Counter],TB_NextURL=TB_TempArray[TB_Counter].href,TB_NextHTML="<span id='TB_next'>&nbsp;&nbsp;<a href='#'>"+thickboxL10n.next+"</a></span>"):(TB_PrevCaption=TB_TempArray[TB_Counter],TB_PrevURL=TB_TempArray[TB_Counter].href,TB_PrevHTML="<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>"+
thickboxL10n.prev+"</a></span>"):(TB_FoundURL=!0,TB_imageCount=thickboxL10n.image+" "+(TB_Counter+1)+" "+thickboxL10n.of+" "+TB_TempArray.length);TB_FirstCaption=TB_TempArray[0];TB_FirstURL=TB_TempArray[0].href;TB_LastCaption=TB_TempArray[TB_TempArray.length-1];TB_LastURL=TB_TempArray[TB_TempArray.length-1].href}imgPreloader=new Image;imgPreloader.onload=function(){imgPreloader.onload=null;var d=c.replace(/^[^\?]+\??/,""),e=tb_parseQuery(d),g=tb_getPageSize(),d=g[0]-150,i=g[1]-150,l=e.width?Math.min(e.width*
1,imgPreloader.width):imgPreloader.width,g=e.height?Math.min(e.height*1,imgPreloader.height):imgPreloader.height;if(tb_options.auto_resize)if(l>d){g=g*(d/l);l=d;if(g>i){l=l*(i/g);g=i}}else if(g>i){l=l*(i/g);g=i;if(l>d){g=g*(d/l);l=d}}typeof a=="object"&&(a=tb_caption(a));TB_Image="<img id='TB_Image' src='"+c+"' width='"+l+"' height='"+g+"' alt='"+a+"'/>";if(tb_options.click_img=="close"||!b&&tb_options.click_end=="close")TB_Image="<a href='' id='TB_ImageOff' title='"+thickboxL10n.close+"'>"+TB_Image+
"</a>";TB_Caption="<div id='TB_caption'>"+a+"<div id='TB_secondLine'>"+TB_imageCount+TB_PrevHTML+TB_NextHTML+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><img src='"+tb_closeImage+"' /></a></div>";tb_options.effect_cap!="none"&&(TB_Caption="<div id='TB_CaptionBar'>"+TB_Caption+"</div>");switch(tb_options.position_cap){case "top":jQuery("#TB_window").append(TB_Caption+TB_Image).addClass("TB_imageContent TB_captionTop");break;case "bottom":jQuery("#TB_window").append(TB_Image+
TB_Caption).addClass("TB_imageContent TB_captionBottom");break;case "none":jQuery("#TB_window").append(TB_Image).addClass("TB_imageContent")}(!b||!a)&&jQuery("#TB_window").addClass("TB_singleLine");d=tb_getSize(jQuery("#TB_Image"),"margin");d[1]<g&&(d[1]=d[1]+g);TB_WIDTH=d[0];TB_HEIGHT=d[1]+tb_getSize(jQuery("#TB_closeWindow"),"margin")[1];if(TB_WIDTH<e.width*1){TB_WIDTH=e.width*1;jQuery("#TB_Image").css({marginLeft:"auto",marginRight:"auto"})}TB_HEIGHT<e.height*1&&(TB_HEIGHT=e.height*1);e.modal==
"true"&&jQuery("#TB_overlay").unbind();jQuery("#TB_closeWindowButton").click(tb_remove);if(TB_PrevHTML!==""){var k=function(){jQuery(document).unbind(".thickbox");jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window' class='TB_Transition'></div>");tb_show(TB_PrevCaption,TB_PrevURL,b);return false};jQuery("#TB_prev").click(k);var p=function(){jQuery(document).unbind(".thickbox");jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window' class='TB_Transition'></div>");
tb_show(TB_FirstCaption,TB_FirstURL,b);return false}}if(TB_NextHTML!==""){var n=function(){jQuery(document).unbind(".thickbox");jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window' class='TB_Transition'></div>");tb_show(TB_NextCaption,TB_NextURL,b);return false};jQuery("#TB_next").click(n);var o=function(){jQuery(document).unbind(".thickbox");jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window' class='TB_Transition'></div>");tb_show(TB_LastCaption,TB_LastURL,
b);return false}}if(b&&tb_options.click_img=="next"){var m,h,f;if(TB_NextHTML!=""){m="TB_ImageNext";h=thickboxL10n.next;f=n}else if(tb_options.click_end=="close"){m="TB_ImageClose";h=thickboxL10n.close;f=tb_remove}else if(tb_options.click_end=="loop"&&TB_PrevHTML!=""){m="TB_ImageFirst";h=thickboxL10n.first;f=p}if(m&&h&&f){d=d[1];jQuery("#TB_window").append("<div id='TB_ImageClick'><a href='' id='"+m+"' title='"+h+"' style='height:"+d+"px;'><span></span></a></div>");jQuery("#"+m).click(f)}}else if(b&&
tb_options.click_img=="prev_next"){var j,q,r;if(TB_PrevHTML!=""){m="TB_ImagePrev";h=thickboxL10n.prev;f=k}if(TB_NextHTML!=""){j="TB_ImageNext";q=thickboxL10n.next;r=n}if(TB_PrevHTML=="")if(tb_options.click_end=="close"){m="TB_ImageClose";h=thickboxL10n.close;f=tb_remove}else if(tb_options.click_end=="loop"&&TB_NextHTML!=""){m="TB_ImageLast";h=thickboxL10n.last;f=o}if(TB_NextHTML=="")if(tb_options.click_end=="close"){j="TB_ImageClose2";q=thickboxL10n.close;r=tb_remove}else if(tb_options.click_end==
1,imgPreloader.width):imgPreloader.width,g=e.height?Math.min(e.height*1,imgPreloader.height):imgPreloader.height;if(tb_options.auto_resize)if(l>d){g=g*(d/l);l=d;if(g>i){l=l*(i/g);g=i}}else if(g>i){l=l*(i/g);g=i;if(l>d){g=g*(d/l);l=d}}typeof a=="object"&&(a=tb_caption(a));TB_Image="<img id='TB_Image' src='"+c+"' width='"+l+"' height='"+g+"' alt='"+a+"'/>";tb_options.click_img=="close"||!b&&tb_options.click_end=="close"?TB_Image="<a href='' id='TB_ImageOff' title='"+thickboxL10n.close+"'>"+TB_Image+
"</a>":tb_options.click_img=="open"&&(TB_Image="<a href='"+c+"' target='_blank' title='"+thickboxL10n.open+"'>"+TB_Image+"</a>");TB_Caption="<div id='TB_caption'>"+a+"<div id='TB_secondLine'>"+TB_imageCount+TB_PrevHTML+TB_NextHTML+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='"+thickboxL10n.close+"'><img src='"+tb_closeImage+"' /></a></div>";tb_options.effect_cap!="none"&&(TB_Caption="<div id='TB_CaptionBar'>"+TB_Caption+"</div>");switch(tb_options.position_cap){case "top":jQuery("#TB_window").append(TB_Caption+
TB_Image).addClass("TB_imageContent TB_captionTop");break;case "bottom":jQuery("#TB_window").append(TB_Image+TB_Caption).addClass("TB_imageContent TB_captionBottom");break;case "none":jQuery("#TB_window").append(TB_Image).addClass("TB_imageContent")}(!b||!a)&&jQuery("#TB_window").addClass("TB_singleLine");d=tb_getSize(jQuery("#TB_Image"),"margin");d[1]<g&&(d[1]=d[1]+g);TB_WIDTH=d[0];TB_HEIGHT=d[1]+tb_getSize(jQuery("#TB_closeWindow"),"margin")[1];if(TB_WIDTH<e.width*1){TB_WIDTH=e.width*1;jQuery("#TB_Image").css({marginLeft:"auto",
marginRight:"auto"})}TB_HEIGHT<e.height*1&&(TB_HEIGHT=e.height*1);e.modal=="true"&&jQuery("#TB_overlay").unbind();jQuery("#TB_closeWindowButton").click(tb_remove);if(TB_PrevHTML!==""){var k=function(){jQuery(document).unbind(".thickbox");jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window' class='TB_Transition'></div>");tb_show(TB_PrevCaption,TB_PrevURL,b);return false};jQuery("#TB_prev").click(k);var p=function(){jQuery(document).unbind(".thickbox");jQuery("#TB_window").remove();
jQuery("body").append("<div id='TB_window' class='TB_Transition'></div>");tb_show(TB_FirstCaption,TB_FirstURL,b);return false}}if(TB_NextHTML!==""){var n=function(){jQuery(document).unbind(".thickbox");jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window' class='TB_Transition'></div>");tb_show(TB_NextCaption,TB_NextURL,b);return false};jQuery("#TB_next").click(n);var o=function(){jQuery(document).unbind(".thickbox");jQuery("#TB_window").remove();jQuery("body").append("<div id='TB_window' class='TB_Transition'></div>");
tb_show(TB_LastCaption,TB_LastURL,b);return false}}if(b&&tb_options.click_img=="next"){var m,h,f;if(TB_NextHTML!=""){m="TB_ImageNext";h=thickboxL10n.next;f=n}else if(tb_options.click_end=="close"){m="TB_ImageClose";h=thickboxL10n.close;f=tb_remove}else if(tb_options.click_end=="loop"&&TB_PrevHTML!=""){m="TB_ImageFirst";h=thickboxL10n.first;f=p}if(m&&h&&f){d=d[1];jQuery("#TB_window").append("<div id='TB_ImageClick'><a href='' id='"+m+"' title='"+h+"' style='height:"+d+"px;'><span></span></a></div>");
jQuery("#"+m).click(f)}}else if(b&&tb_options.click_img=="prev_next"){var j,q,r;if(TB_PrevHTML!=""){m="TB_ImagePrev";h=thickboxL10n.prev;f=k}if(TB_NextHTML!=""){j="TB_ImageNext";q=thickboxL10n.next;r=n}if(TB_PrevHTML=="")if(tb_options.click_end=="close"){m="TB_ImageClose";h=thickboxL10n.close;f=tb_remove}else if(tb_options.click_end=="loop"&&TB_NextHTML!=""){m="TB_ImageLast";h=thickboxL10n.last;f=o}if(TB_NextHTML=="")if(tb_options.click_end=="close"){j="TB_ImageClose2";q=thickboxL10n.close;r=tb_remove}else if(tb_options.click_end==
"loop"&&TB_PrevHTML!=""){j="TB_ImageFirst";q=thickboxL10n.first;r=p}if(m&&h&&f||j&&q&&r){d=d[1];g=link2="";m&&(h&&f)&&(g="<a href='' id='"+m+"' class='TB_ImageLeft' title='"+h+"' style='height:"+d+"px;'></a>");j&&(q&&r)&&(link2="<a href='' id='"+j+"' class='TB_ImageRight' title='"+q+"' style='height:"+d+"px;'></a>");jQuery("#TB_window").append("<div id='TB_ImageClick'>"+g+link2+"</div>");g&&jQuery("#"+m).click(f);link2&&jQuery("#"+j).click(r);jQuery.browser.msie&&parseInt(jQuery.browser.version)<=
7&&jQuery("#TB_ImageClick > a").focus(function(){this.blur()})}}jQuery(document).bind("keydown.thickbox",function(a){a.stopImmediatePropagation();e.modal!="true"&&jQuery.inArray(a.which,tb_options.keys_close)!=-1?jQuery(document).triggerHandler("wp_CloseOnEscape",[{event:a,what:"thickbox",cb:tb_remove}])||tb_remove():jQuery.inArray(a.which,tb_options.keys_prev)!=-1||a.shiftKey&&jQuery.inArray(a.which,tb_options.keys_prev.shift)!=-1?TB_PrevHTML!=""&&k():jQuery.inArray(a.which,tb_options.keys_next)!=
-1?TB_NextHTML!=""&&n():jQuery.inArray(a.which,tb_options.keys_first)!=-1?TB_PrevHTML!=""&&p():jQuery.inArray(a.which,tb_options.keys_last)!=-1&&TB_NextHTML!=""&&o();return false});b&&tb_options.wheel_img=="prev_next"?jQuery("#TB_window").bind("mousewheel.thickbox DOMMouseScroll.thickbox",function(a){a.stopImmediatePropagation();var b=0,a=a.originalEvent;a.wheelDelta?b=a.wheelDelta:a.detail&&(b=-a.detail);jQuery(window).one("MozMousePixelScroll",function(){return false});if(b>0){if(TB_PrevHTML!=""){k();