diff options
-rw-r--r-- | admin/plugins_list.php | 47 | ||||
-rw-r--r-- | admin/themes/clear/theme.css | 12 | ||||
-rw-r--r-- | admin/themes/default/icon/help-min.png | bin | 0 -> 1191 bytes | |||
-rw-r--r-- | admin/themes/default/template/plugins_list.tpl | 244 | ||||
-rw-r--r-- | admin/themes/default/theme.css | 33 | ||||
-rw-r--r-- | admin/themes/roma/theme.css | 8 | ||||
-rw-r--r-- | language/en_UK/admin.lang.php | 3 | ||||
-rw-r--r-- | language/fr_FR/admin.lang.php | 3 | ||||
-rw-r--r-- | themes/default/js/plugins/jquery.tipTip.minified.js | 10 |
9 files changed, 269 insertions, 91 deletions
diff --git a/admin/plugins_list.php b/admin/plugins_list.php index 4ec64ec29..3f38356b5 100644 --- a/admin/plugins_list.php +++ b/admin/plugins_list.php @@ -30,8 +30,13 @@ include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php'); $template->set_filenames(array('plugins' => 'plugins_list.tpl')); -$base_url = get_root_url().'admin.php?page='.$page['page']; -$action_url = $base_url.'&plugin='.'%s'.'&pwg_token='.get_pwg_token(); +// TODO : use a session parameter +$plugin_order = isset($_GET['plugin_order']) ? $_GET['plugin_order'] : 'state'; +$plugin_display = isset($_GET['plugin_display']) ? $_GET['plugin_display'] : 'compact'; + +$base_url = get_root_url().'admin.php?page='.$page['page'].'&plugin_order='.$plugin_order.'&plugin_display='.$plugin_display; +$pwg_token = get_pwg_token(); +$action_url = $base_url.'&plugin='.'%s'.'&pwg_token='.$pwg_token; $plugins = new plugins(); @@ -70,6 +75,7 @@ $plugins->sort_fs_plugins('name'); $plugins->get_merged_extensions(); $plugins->get_incompatible_plugins(); $merged_plugins = false; +$tpl_plugins = array(); foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) { @@ -81,6 +87,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) } $tpl_plugin = array( + 'ID' => $plugin_id, 'NAME' => $fs_plugin['name'], 'VISIT_URL' => $fs_plugin['uri'], 'VERSION' => $fs_plugin['version'], @@ -108,7 +115,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) $merged_plugins = true; } - $template->append('plugins', $tpl_plugin); + array_push($tpl_plugins, $tpl_plugin); } $template->append('plugin_states', 'active'); @@ -128,8 +135,8 @@ if (count($missing_plugin_ids) > 0) { foreach($missing_plugin_ids as $plugin_id) { - $template->append( - 'plugins', + array_push( + $tpl_plugins, array( 'NAME' => $plugin_id, 'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'], @@ -142,5 +149,35 @@ if (count($missing_plugin_ids) > 0) $template->append('plugin_states', 'missing'); } +// sort plugins : state or name +if ($plugin_order == 'name') +{ + function cmp($a, $b) + { + return strcasecmp($a['NAME'], $b['NAME']); + } +} +else +{ + function cmp($a, $b) + { + $s = array('merged' => 0, 'missing' => 1, 'active' => 2, 'inactive' => 3); + + if($a['STATE'] == $b['STATE']) + return strcasecmp($a['NAME'], $b['NAME']); + else + return $s[$a['STATE']] >= $s[$b['STATE']]; + } + $plugin_order = 'state'; +} + +usort($tpl_plugins, 'cmp'); +$template->assign(array( + 'plugin_order' => $plugin_order, + 'plugin_display' => $plugin_display, + 'plugins' => $tpl_plugins, + 'PWG_TOKEN' => $pwg_token, +)); + $template->assign_var_from_handle('ADMIN_CONTENT', 'plugins'); ?>
\ No newline at end of file diff --git a/admin/themes/clear/theme.css b/admin/themes/clear/theme.css index f1060b7d3..8a8f7ccc2 100644 --- a/admin/themes/clear/theme.css +++ b/admin/themes/clear/theme.css @@ -255,16 +255,18 @@ display:block; height:85px; left:225px; position:relative; top:-42px; width:313p #pwgHead A:hover, #footer A:hover {color:black; border-color:black;} #footer { background-image: url(images/piwigo_logo_small.png);} -.pluginBox {background-color:#ddd;color:#333} -.pluginBoxNameCell {font-weight:bold;} +.pluginBox, .pluginMiniBox {background-color:#ddd;color:#353535;border:1px solid #ddd;} +.pluginBoxNameCell, .pluginMiniBoxNameCell {color:#111;} +.pluginBox.active, .pluginMiniBox.active {border-color:#666;background-color:#dadada;} +.pluginBox.incompatible, .pluginMiniBox.incompatible {border-color:#a00 !important;} +.pluginBox.missing, .pluginBox.merged, .pluginMiniBox.missing, .pluginMiniBox.merged {background-color:#d99;border:1px solid #a00;} +.plugin-delete {color:#f00;} .languageBox {background-color:#ddd;} .languageName {color:black;} .languageDefault {background-color:#dbe8f3;} -UL.thumbnails li.rank-of-image { - background-color: #ddd; -} +UL.thumbnails li.rank-of-image {background-color: #ddd;} #batchManagerGlobal ul.thumbnails span.wrap2 {background-color:#ddd;} #batchManagerGlobal .thumbSelected {background-color:#C2F5C2 !important} diff --git a/admin/themes/default/icon/help-min.png b/admin/themes/default/icon/help-min.png Binary files differnew file mode 100644 index 000000000..9a825692f --- /dev/null +++ b/admin/themes/default/icon/help-min.png diff --git a/admin/themes/default/template/plugins_list.tpl b/admin/themes/default/template/plugins_list.tpl index 101227231..39b1725bd 100644 --- a/admin/themes/default/template/plugins_list.tpl +++ b/admin/themes/default/template/plugins_list.tpl @@ -1,92 +1,218 @@ -{footer_script} +{combine_script id='jquery.ajaxmanager' load='footer' require='jquery' path='themes/default/js/plugins/jquery.ajaxmanager.js' } + +{footer_script require='jquery.ajaxmanager'} +/* incompatible message */ var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}'; incompatible_msg += '\n'; incompatible_msg += '{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; +/* group action */ +var pwg_token = '{$PWG_TOKEN}'; +var confirmMsg = '{'Are you sure?'|@translate|@escape:'javascript'}'; {literal} +var queuedManager = jQuery.manageAjax.create('queued', { + queue: true, + maxRequests: 1, + complete: function() { location.reload(); } +}); + jQuery(document).ready(function() { - jQuery('.incompatible').click(function() { + /* group action */ + jQuery('a.deactivate_all').click(function() { + if (confirm(confirmMsg)) { + jQuery('div.active').each(function() { + performPluginAction(jQuery(this).attr('id'), 'deactivate'); + }); + } + }); + jQuery('a.activate_all').click(function() { + if (confirm(confirmMsg)) { + jQuery('div.inactive').each(function() { + performPluginAction(jQuery(this).attr('id'), 'activate'); + }); + } + }); + function performPluginAction(id, action) { + queuedManager.add({ + type: 'GET', + dataType: 'json', + url: 'ws.php', + data: { method: 'pwg.plugins.performAction', action: action, plugin: id, pwg_token: pwg_token, format: 'json' }, + success: function(data) { + if (data['stat'] == 'ok') { + if (action == 'deactivate') + jQuery("#"+id).removeClass('active').addClass('inactive'); + else + jQuery("#"+id).removeClass('inactive').addClass('active'); + } + } + }); + }; + + /* incompatible message */ + jQuery('.incompatible a.incompatible').click(function() { return confirm(incompatible_msg); }); + + /* TipTips */ jQuery('.warning').tipTip({ 'delay' : 0, 'fadeIn' : 200, - 'fadeOut' : 200 + 'fadeOut' : 200, + 'maxWidth':'250px' + }).click(function(){ + return false; + }); + jQuery('.pluginMiniBoxDesc').tipTip({ + 'delay' : 0, + 'fadeIn' : 200, + 'fadeOut' : 200, + 'maxWidth':'300px', /* not effective, TipTip bug */ + 'keepAlive':true + }).click(function(){ + return false; }); }); -{/literal}{/footer_script} +{/literal} +{/footer_script} <div class="titrePage"> + <span class="sort"> + <form action="" method="get" name="change_order"> + <input type="hidden" name="page" value="plugins_list"/> + {'Sort order'|@translate} : + <select name="plugin_order" onchange="this.form.submit();"> + <option value="status" {if $plugin_order=='state'}selected="selected"{/if}>{'Status'|@translate}</option> + <option value="name" {if $plugin_order=='name'}selected="selected"{/if}>{'Name'|@translate}</option> + </select> + | + {'Display'|@translate} : + <select name="plugin_display" onchange="this.form.submit();"> + <option value="compact" {if $plugin_diplay=='compact'}selected="selected"{/if}>{'Compact'|@translate}</option> + <option value="complete" {if $plugin_display=='complete'}selected="selected"{/if}>{'Complete'|@translate}</option> + </select> + | + <a class="deactivate_all">{'Deactivate'|@translate} {'all'|@translate}</a> + {* | + <a class="activate_all">{'Activate'|@translate} {'all'|@translate}</a> *} + </form> + </span> <h2>{'Plugins'|@translate}</h2> </div> {if isset($plugins)} -{foreach from=$plugin_states item=plugin_state} -<fieldset> - <legend> - {if $plugin_state == 'active'} - {'Active Plugins'|@translate} - - {elseif $plugin_state == 'inactive'} - {'Inactive Plugins'|@translate} +{assign var='field_name' value='null'} +{foreach from=$plugins item=plugin name=plugins_loop} + +{if $plugin_order == 'state' AND $field_name != $plugin.STATE} + {if $field_name != 'null'}</fieldset>{/if} + <fieldset class="pluginBoxes pluginsByState"> + <legend> + {if $plugin.STATE == 'active'} + {'Active Plugins'|@translate} + {elseif $plugin.STATE == 'inactive'} + {'Inactive Plugins'|@translate} + {elseif $plugin.STATE == 'missing'} + {'Missing Plugins'|@translate} + {elseif $plugin.STATE == 'merged'} + {'Obsolete Plugins'|@translate} + {/if} + </legend> + {assign var='field_name' value=$plugin.STATE} - {elseif $plugin_state == 'missing'} - {'Missing Plugins'|@translate} +{elseif $field_name == 'null'} + <fieldset class="pluginBoxes pluginsByName"> + {assign var='field_name' value='not_null'} - {elseif $plugin_state == 'merged'} - {'Obsolete Plugins'|@translate} +{/if} + {if not empty($plugin.AUTHOR)} + {if not empty($plugin.AUTHOR_URL)} + {assign var='author' value="<a href='%s'>%s</a>"|@sprintf:$plugin.AUTHOR_URL:$plugin.AUTHOR} + {else} + {assign var='author' value='<u>'|cat:$plugin.AUTHOR|cat:'</u>'} + {/if} {/if} - </legend> - {foreach from=$plugins item=plugin name=plugins_loop} - {if $plugin.STATE == $plugin_state} - <div class="pluginBox"> - <table> - <tr> - <td class="pluginBoxNameCell{if $plugin.INCOMPATIBLE} warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}{/if}"> - {$plugin.NAME} - </td> - <td>{$plugin.DESC}</td> - </tr> - <tr> - <td> - {if $plugin.STATE == 'active'} - <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> - | <a href="{$plugin.U_ACTION}&action=restore" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Restore'|@translate}</a> + + {if $plugin_display == 'complete'} + <div id="{$plugin.ID}" class="pluginBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}"> + <table> + <tr> + <td class="pluginBoxNameCell"> + {if $plugin.INCOMPATIBLE}<a class="warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}"></a>{/if} + {$plugin.NAME} + </td> + <td>{$plugin.DESC}</td> + </tr> + <tr> + <td> + {if $plugin.STATE == 'active'} + <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> + | <a href="{$plugin.U_ACTION}&action=restore" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Restore'|@translate}</a> - {elseif $plugin_state == 'inactive'} - <a href="{$plugin.U_ACTION}&action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> - | <a href="{$plugin.U_ACTION}&action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a> + {elseif $plugin.STATE == 'inactive'} + <a href="{$plugin.U_ACTION}&action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> + | <a href="{$plugin.U_ACTION}&action=delete" class="plugin-delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a> - {elseif $plugin_state == 'missing'} - <a href="{$plugin.U_ACTION}&action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> + {elseif $plugin.STATE == 'missing'} + <a href="{$plugin.U_ACTION}&action=uninstall" class="plugin-delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> - {elseif $plugin_state == 'merged'} - <a href="{$plugin.U_ACTION}&action=delete">{'Delete'|@translate}</a> - {/if} - </td> - <td> - {'Version'|@translate} {$plugin.VERSION} - {if not empty($plugin.AUTHOR)} - {if not empty($plugin.AUTHOR_URL)} - {assign var='author' value='<a href="%s">%s</a>'|@sprintf:$plugin.AUTHOR_URL:$plugin.AUTHOR} - {else} - {assign var='author' value=$plugin.AUTHOR} - {/if} - | {'By %s'|@translate|@sprintf:$author} - {/if} + {elseif $plugin.STATE == 'merged'} + <a href="{$plugin.U_ACTION}&action=delete" class="plugin-delete">{'Delete'|@translate}</a> + {/if} + </td> + <td> + {'Version'|@translate} {$plugin.VERSION} + + {if not empty($author)} + | {'By %s'|@translate|@sprintf:$author} + {/if} + {if not empty($plugin.VISIT_URL)} + | <a class="externalLink" href="{$plugin.VISIT_URL}">{'Visit plugin site'|@translate}</a> + {/if} + </td> + </tr> + </table> + </div> {*<!-- pluginBox -->*} + + {elseif $plugin_display == 'compact'} {if not empty($plugin.VISIT_URL)} - | <a class="externalLink" href="{$plugin.VISIT_URL}">{'Visit plugin site'|@translate}</a> - {/if} - </td> - </tr> - </table> - </div> + {assign var='version' value="<a class='externalLink' href='"|cat:$plugin.VISIT_URL|cat:"'>"|cat:$plugin.VERSION|cat:"</a>"} + {else + {assign var='version' value=$plugin.VERSION} {/if} - {/foreach} -</fieldset> + + <div id="{$plugin.ID}" class="pluginMiniBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}"> + <div class="pluginMiniBoxNameCell"> + {if $plugin.INCOMPATIBLE}<a class="warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}"></a>{/if} + {$plugin.NAME} + <a class="pluginMiniBoxDesc" title="{if !empty($author)}{'By %s'|@translate|@sprintf:$author} | {/if}{'Version'|@translate} {$version}<br/>{$plugin.DESC|@escape:'html'}"></a> + </div> + <div class="pluginActions"> + <div> + {if $plugin.STATE == 'active'} + <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> + | <a href="{$plugin.U_ACTION}&action=restore" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Restore'|@translate}</a> + + {elseif $plugin.STATE == 'inactive'} + <a href="{$plugin.U_ACTION}&action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> + | <a href="{$plugin.U_ACTION}&action=delete" class="plugin-delete"onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a> + + {elseif $plugin.STATE == 'missing'} + <a href="{$plugin.U_ACTION}&action=uninstall" class="plugin-delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> + + {elseif $plugin.STATE == 'merged'} + <a href="{$plugin.U_ACTION}&action=delete" class="plugin-delete">{'Delete'|@translate}</a> + {/if} + </div> + </div> + </div> {*<!-- pluginMiniBox -->*} + + {/if} + {/foreach} + </fieldset> {/if} diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css index bb645c256..fc093c009 100644 --- a/admin/themes/default/theme.css +++ b/admin/themes/default/theme.css @@ -927,13 +927,28 @@ h2:lang(en) { text-transform:capitalize; } .checkActions {text-align:left;padding:0;margin:0;} .comment A:hover {border:none;} +.pluginBoxes {text-align:left;} +.author-group {text-align:left;background:url('icon/remove_filter.png') left center no-repeat;padding-left:15px;margin-left:-15px;} + .pluginBox {margin-bottom:10px;-moz-border-radius:5px;} -.pluginBox table {width:99%} +.pluginBox table {width:99%;} .pluginBox td {text-align:left;} -.pluginBox td.pluginDesc {cursor:pointer;} -.pluginBox td.pluginDesc img{vertical-align:middle;} -.pluginBox td em{float:right;} -.pluginBoxNameCell {width:150px; vertical-align:top;} +.pluginBox td.pluginDesc img {vertical-align:middle;} +.pluginBoxNameCell {width:180px; vertical-align:top;} +.pluginBox.inactive, .pluginBox.uninstalled {margin-left:20px;opacity:0.65;filter:alpha(opacity=65);} +.pluginsByState .pluginBox.inactive, .pluginsByState .pluginBox.uninstalled {margin-left:0px;opacity:0.8;filter:alpha(opacity=80);} + +.pluginMiniBox {display:inline-table; text-align:center; width:250px; height:40px; margin:5px; -moz-border-radius:5px; overflow:hidden; } +.pluginMiniBoxNameCell {font-size:1.05em; margin:5px 0;} +.pluginActions {display: table-row; font-size:12px; } +.pluginActions DIV {display: table-cell; vertical-align: middle; line-height:18px; } +.pluginMiniBox.inactive, .pluginMiniBox.uninstalled {opacity:0.65;filter:alpha(opacity=65);} +.pluginsByState .pluginMiniBox.inactive, .pluginsByState .pluginMiniBox.uninstalled {opacity:0.8;filter:alpha(opacity=80);} + +.pluginMiniBoxDesc{float:right;margin:0 4px 0 -20px;} +.pluginMiniBoxDesc:after{content:url(icon/help-min.png);} +.warning:before {content:url(icon/warning.png);vertical-align:top;} +fieldset.pluginsByName{border:none;} .languageBoxes {min-height:0;text-align:left;} .languageBox {display:inline-table; text-align:center; width:200px; height:40px; margin:5px; -moz-border-radius:5px; overflow:hidden; } @@ -1042,10 +1057,4 @@ LEGEND { #batchManagerGlobal a.removeFilter:hover {background: url(icon/remove_filter_hover.png); border:none;} #batchManagerGlobal .removeFilter span {display:none} #batchManagerGlobal #applyFilterBlock {margin-top:20px;} -#batchManagerGlobal .useFilterCheckbox {display:none} - -.warning { - background:url(icon/warning.png) no-repeat top left; - width: 130px; - padding-left: 20px; -} +#batchManagerGlobal .useFilterCheckbox {display:none}
\ No newline at end of file diff --git a/admin/themes/roma/theme.css b/admin/themes/roma/theme.css index 8830f5a12..b32c49cb9 100644 --- a/admin/themes/roma/theme.css +++ b/admin/themes/roma/theme.css @@ -234,8 +234,12 @@ display:block; height:85px; left:225px; position:relative; top:-42px; width:313p #pwgHead, #footer {background-color:#222;} #footer {background-image: url(images/piwigo_logo_small.png);} -.pluginBox {background-color:#333;color:#999} -.pluginBoxNameCell {color:#ccc;} +.pluginBox, .pluginMiniBox {background-color:#333;color:#999;border:1px solid #333;} +.pluginBoxNameCell, .pluginMiniBoxNameCell {color:#ddd;} +.pluginBox.active, .pluginMiniBox.active {border-color:#666;background-color:#383838;} +.pluginBox.incompatible, .pluginMiniBox.incompatible {border-color:#800 !important;} +.pluginBox.missing, .pluginBox.merged, .pluginMiniBox.missing, .pluginMiniBox.merged {background-color:#422;border:1px solid #800;} +.plugin-delete {color:#f00;} .languageBox {background-color:#333;} .languageName {color:#ccc;} diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index cf1bc978a..297d40d90 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -185,6 +185,8 @@ $lang['Classic display'] = "Classic display"; $lang['clean'] = "clean up"; $lang['Comments for all'] = "Comments for all"; $lang['Comments'] = "Comments"; +$lang['Compact'] = "Compact"; +$lang['Complete'] = "Complete"; $lang['Complementary mail content'] = "Complementary mail content"; $lang['Complementary mail content'] = "Complementary mail content"; $lang['Configuration'] = "Configuration"; @@ -569,6 +571,7 @@ $lang['Representation of albums'] = "Representation of albums"; $lang['Representative'] = "Representative"; $lang['Represents'] = "Represents"; $lang['Resize'] = 'Resize'; +$lang['Restore'] = "Restore"; $lang['Results of miniaturization'] = "Miniaturization process results"; $lang['Save order'] = "Save order"; $lang['Save page visits by administrators'] = "Record pages visited by administrators"; diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php index 0948e8c38..893d9a916 100644 --- a/language/fr_FR/admin.lang.php +++ b/language/fr_FR/admin.lang.php @@ -794,4 +794,7 @@ $lang['Do you want to activate anyway?'] = 'Voulez-vous l\'activer quand même?' $lang['THIS PLUGIN IS NOW PART OF PIWIGO CORE! DELETE IT NOW.'] = 'CE PLUGIN FAIT DÉSORMAIS PARTIE DU CORE DE PIWIGO! SUPPRIMEZ-LE.'; $lang['ERROR: THIS PLUGIN IS MISSING BUT IT IS INSTALLED! UNINSTALL IT NOW.'] = 'ERREUR: CE PLUGIN EST MANQUANT MAIS TOUJOURS INSTALLÉ! DÉSINSTALLEZ-LE.'; $lang['display'] = 'Afficher'; +$lang['Compact'] = "Compact"; +$lang['Complete'] = "Complet"; +$lang['Restore'] = "Restaurer"; ?>
\ No newline at end of file diff --git a/themes/default/js/plugins/jquery.tipTip.minified.js b/themes/default/js/plugins/jquery.tipTip.minified.js index 62b7cfde0..cdf3a892b 100644 --- a/themes/default/js/plugins/jquery.tipTip.minified.js +++ b/themes/default/js/plugins/jquery.tipTip.minified.js @@ -4,7 +4,7 @@ * www.drewwilson.com * code.drewwilson.com/entry/tiptip-jquery-plugin * - * Version 1.2 - Updated: Jan. 13, 2010 + * Version 1.3 - Updated: Mar. 23, 2010 * * This Plug-In will create a custom tooltip to replace the default * browser tooltip. It is extremely lightweight and very smart in @@ -18,10 +18,4 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ -(function($){$.fn.tipTip=function(options){var defaults={maxWidth:"200px",edgeOffset:3,delay:400,fadeIn:200,fadeOut:200,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow");} -return this.each(function(){var org_elem=$(this);var org_title=org_elem.attr("title");if(org_title!=""){org_elem.removeAttr("title");var timeout=false;org_elem.hover(function(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(w_compare<0){if((w_compare+left)<parseInt($(window).scrollLeft())){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare);}else if((tip_w+left)>parseInt($(window).width())){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare);}} -if((top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop())){t_class=t_class+"_top";arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset));}else if(((top+org_height)-(opts.edgeOffset+tip_h))<0||t_class==""){t_class=t_class+"_bottom";arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset);} -if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5;}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5;} -if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5;} -tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout);} -timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn);},opts.delay);},function(){opts.exit.call(this);if(timeout){clearTimeout(timeout);}tiptip_holder.fadeOut(opts.fadeOut);});}});}})(jQuery);
\ No newline at end of file +(function($){$.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')))}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow")}return this.each(function(){var org_elem=$(this);if(opts.content){var org_title=opts.content}else{var org_title=org_elem.attr(opts.attribute)}if(org_title!=""){if(!opts.content){org_elem.removeAttr(opts.attribute)}var timeout=false;if(opts.activation=="hover"){org_elem.hover(function(){active_tiptip()},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}else if(opts.activation=="focus"){org_elem.focus(function(){active_tiptip()}).blur(function(){deactive_tiptip()})}else if(opts.activation=="click"){org_elem.click(function(){active_tiptip();return false}).hover(function(){},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}function active_tiptip(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else if(opts.defaultPosition=="top"){t_class="_top"}else if(opts.defaultPosition=="left"){t_class="_left"}else if(opts.defaultPosition=="right"){t_class="_right"}var right_compare=(w_compare+left)<parseInt($(window).scrollLeft());var left_compare=(tip_w+left)>parseInt($(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop());var bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay)}function deactive_tiptip(){opts.exit.call(this);if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut)}}})}})(jQuery);
\ No newline at end of file |