Skip to content

Commit fafc8e1

Browse files
author
Jose Pardilla
committed
update image titles code
Part of the code was based on 3.0.2, this commit fixes inconsistencies resulting from that.
1 parent c9d953e commit fafc8e1

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

fancybox.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ function mfbfw_defaults() {
117117
'callbackOnComplete' => 'function() { alert("Complete!"); }',
118118
'callbackOnCleanup' => 'function() { alert("CleanUp!"); }',
119119
'callbackOnClose' => 'function() { alert("Close!"); }',
120-
'copyTitleFunction' => 'var arr = jQuery("a.fancybox");
121-
jQuery.each(arr, function() {
122-
var title = jQuery(this).children("img").attr("title");
123-
jQuery(this).attr("title",title);
124-
})',
120+
'copyTitleFunction' => 'var arr = jQuery("a.fancybox");
121+
jQuery.each(arr, function() {
122+
var title = jQuery(this).children("img").attr("title");
123+
jQuery(this).attr("title",title);
124+
})',
125125

126126
// Troubleshooting
127127
'nojQuery' => '',
@@ -236,9 +236,8 @@ function mfbfw_init() {
236236
<script type="text/javascript">
237237
jQuery(function(){
238238
239-
jQuery.fn.getTitle = function() { // Copy the title of every IMG tag and add it to its parent A so that fancybox can show titles';
240-
<?php echo $settings['copyTitleFunction']; ?>
241-
echo '
239+
jQuery.fn.getTitle = function() { // Copy the title of every IMG tag and add it to its parent A so that fancybox can show titles
240+
' . $mfbfw['copyTitleFunction'] . '
242241
}
243242
244243
// Supported file extensions

lib/admin-tab-other.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,31 @@
4747
</td>
4848
</tr>
4949

50+
<tr valign="top">
51+
<th scope="row"><?php _e('Image Title function', 'mfbfw'); ?></th>
52+
<td>
53+
<fieldset>
54+
55+
<label for="copyTitleFunction">
56+
<?php _e('Function to customize image titles', 'mfbfw'); ?>
57+
<textarea rows="10" cols="50" class="large-text code" name="mfbfw[copyTitleFunction]" wrap="physical" id="copyTitleFunction"><?php echo ($mfbfw['copyTitleFunction']); ?></textarea>
58+
</label><br />
59+
60+
<small><em><?php _e('This option allows you to edit image titles with your own jQuery function.', 'mfbfw'); ?></em></small><br /><br />
61+
62+
<small><strong><em><?php _e('Example:', 'mfbfw'); ?></em></strong></small><br />
63+
<small><em><code>
64+
var arr = jQuery("a.fancybox");<br />
65+
jQuery.each(arr, function() {<br />
66+
&nbsp;&nbsp;var title = jQuery(this).children("img").attr("title");<br />
67+
&nbsp;&nbsp;jQuery(this).attr("title",title);<br />
68+
})
69+
</code></em></small><br /><br />
70+
71+
</fieldset>
72+
</td>
73+
</tr>
74+
5075
<tr valign="top">
5176
<th scope="row"><?php _e('Callbacks', 'mfbfw'); ?></th>
5277
<td>
@@ -85,15 +110,10 @@
85110
<?php _e('Callback on <strong>Closed</strong> event: Will be called once FancyBox is closed', 'mfbfw'); ?>
86111
<textarea rows="10" cols="50" class="large-text code" name="mfbfw[callbackOnClose]" wrap="physical" id="callbackOnClosed"><?php echo ($mfbfw['callbackOnClose']); ?></textarea>
87112
</label><br /><br/>
88-
89-
<label for="copyTitleFunction">
90-
<?php _e('Function to copy title from different source then Fancybox default anchor title', 'mfbfw'); ?>
91-
<textarea rows="10" cols="50" class="large-text code" name="mfbfw[copyTitleFunction]" wrap="physical" id="copyTitleFunction"><?php echo ($settings['copyTitleFunction']); ?></textarea>
92-
</label><br /><br/>
93113

94114
<small><strong><em><?php _e('Example:', 'mfbfw'); ?></em></strong></small><br />
95115
<small><em><code>function() { alert('Hello world!'); }</code></em></small><br />
96-
<small><em><?php _e('Leave empty any speciic callbacks you don\'t need to use.', 'mfbfw'); ?></em></small><br /><br />
116+
<small><em><?php _e('Leave empty any specific callbacks you don\'t need to use.', 'mfbfw'); ?></em></small><br /><br />
97117

98118
</div>
99119

0 commit comments

Comments
 (0)