Skip to content
Extraits de code Groupes Projets
Valider 46318915 rédigé par cerdic's avatar cerdic
Parcourir les fichiers

Les descriptifs des plugins en jTip, pour alleger le chargement de la page.

Mais comment on fait pour cliquer sur les liens maintenant ?
parent 5fdba943
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -32,6 +32,8 @@ dist/images/aide-48_rtl.png -text
dist/images/aide.gif -text
dist/images/aide_rtl.gif -text
dist/images/annonce.gif -text
dist/images/arrow_left.gif -text
dist/images/arrow_right.gif -text
dist/images/article-24.gif -text
dist/images/asuivre-24.gif -text
dist/images/asuivre-48.png -text
......@@ -100,6 +102,7 @@ dist/images/langues-12.gif -text
dist/images/langues-24.gif -text
dist/images/langues-modif-12.gif -text
dist/images/langues-off-12.gif -text
dist/images/loader.gif -text
dist/images/logo-spip.gif -text
dist/images/logo_spip.jpg -text
dist/images/loupe-moins.gif -text
......@@ -222,8 +225,10 @@ dist/javascript/async_upload.js -text
dist/javascript/dragdrop_interface.js -text
dist/javascript/form.js -text
dist/javascript/jquery-1.0.3.js -text
dist/javascript/jtip.js -text
dist/javascript/pause.js -text
dist/jquery.js.html -text
dist/jtip.css -text
dist/modeles/article_mots.html -text
dist/modeles/article_traductions.html -text
dist/modeles/doc.html -text
......@@ -407,6 +412,7 @@ ecrire/exec/gadgets.php -text
ecrire/exec/grouper_mots.php -text
ecrire/exec/iconifier.php -text
ecrire/exec/import_all.php -text
ecrire/exec/info_plugin.php -text
ecrire/exec/informer.php -text
ecrire/exec/informer_auteur.php -text
ecrire/exec/install.php -text
......
dist/images/arrow_left.gif

102 octets

dist/images/arrow_right.gif

102 octets

dist/images/loader.gif

958 octets

/*
* JTip
* By Cody Lindley (http://www.codylindley.com)
* Under an Attribution, Share Alike License
* JTip is built on top of the very light weight jquery library.
*/
//on page load (as soon as its ready) call JT_init
$(document).ready(JT_init);
function JT_init(){
$("a.jTip")
.hover(function(){JT_show(this.href,this.id,this.name)},function(){$('#JT').remove()})
.click(function(){return false});
}
function JT_show(url,linkId,title){
if(title == false)title=" ";
var de = document.documentElement;
var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
var hasArea = w - getAbsoluteLeft(linkId);
var clickElementy = getAbsoluteTop(linkId) - 3; //set y position
var queryString = url.replace(/^[^\?]+\??/,'');
var params = parseQuery( queryString );
if(params['width'] === undefined){params['width'] = 250};
if(params['link'] !== undefined){
$('#' + linkId).bind('click',function(){window.location = params['link']});
$('#' + linkId).css('cursor','pointer');
}
if(hasArea>((params['width']*1)+75)){
$("body").append("<div id='JT' style='width:"+params['width']*1+"px'><div id='JT_arrow_left'></div><div id='JT_close_left'>"+title+"</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");//right side
var arrowOffset = getElementWidth(linkId) + 11;
var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; //set x position
}else{
$("body").append("<div id='JT' style='width:"+params['width']*1+"px'><div id='JT_arrow_right' style='left:"+((params['width']*1)+1)+"px'></div><div id='JT_close_right'>"+title+"</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");//left side
var clickElementx = getAbsoluteLeft(linkId) - ((params['width']*1) + 15); //set x position
}
$('#JT').css({left: clickElementx+"px", top: clickElementy+"px"});
$('#JT').show();
$('#JT_copy').load(url);
}
function getElementWidth(objectId) {
x = document.getElementById(objectId);
return x.offsetWidth;
}
function getAbsoluteLeft(objectId) {
// Get an object left position from the upper left viewport corner
o = document.getElementById(objectId)
oLeft = o.offsetLeft // Get left position from the parent object
while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
oParent = o.offsetParent // Get parent object reference
oLeft += oParent.offsetLeft // Add parent left position
o = oParent
}
return oLeft
}
function getAbsoluteTop(objectId) {
// Get an object top position from the upper left viewport corner
o = document.getElementById(objectId)
oTop = o.offsetTop // Get top position from the parent object
while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
oParent = o.offsetParent // Get parent object reference
oTop += oParent.offsetTop // Add parent top position
o = oParent
}
return oTop
}
function parseQuery ( query ) {
var Params = new Object ();
if ( ! query ) return Params; // return empty object
var Pairs = query.split(/[;&]/);
for ( var i = 0; i < Pairs.length; i++ ) {
var KeyVal = Pairs[i].split('=');
if ( ! KeyVal || KeyVal.length != 2 ) continue;
var key = unescape( KeyVal[0] );
var val = unescape( KeyVal[1] );
val = val.replace(/\+/g, ' ');
Params[key] = val;
}
return Params;
}
function blockEvents(evt) {
if(evt.target){
evt.preventDefault();
}else{
evt.returnValue = false;
}
}
\ No newline at end of file
/* - - - - - - CSS Document - - - - - - - - -
Title : Global style sheet for client-side web development
Author : Cody Lindley
- - - - - - - - - - - - - - - - - - - - - */
.formInfo a, .formInfo a:active, formInfo a:visited{
background-color: #f66;
font-size: 1.3em;
font-weight:bold;
padding:1px 2px;
margin-left:5px;
color:#FFFFFF;
text-decoration: none;
float: right;
}
.formInfo a:hover{
color:#660000;
text-decoration: none;
}
/* ---------->>> jtip <<<---------------------------------------------------------------*/
#JT_arrow_left{
background-image: url(images/arrow_left.gif);
background-repeat: no-repeat;
background-position: left top;
position: absolute;
z-index:101;
left:-12px;
height:23px;
width:10px;
top:-3px;
}
#JT_arrow_right{
background-image: url(images/arrow_right.gif);
background-repeat: no-repeat;
background-position: left top;
position: absolute;
z-index:101;
height:23px;
width:11px;
top:-2px;
}
#JT {
position: absolute;
z-index:100;
border: 2px solid #CCCCCC;
background-color: #fff;
}
#JT_copy{
padding:10px 10px 10px 10px;
color:#333333;
}
.JT_loader{
background-image: url(images/loader.gif);
background-repeat: no-repeat;
background-position: center center;
width:100%;
height:12px;
}
#JT_close_left{
background-color: #CCCCCC;
text-align: left;
padding-left: 8px;
padding-bottom: 5px;
padding-top: 2px;
font-weight:bold;
}
#JT_close_right{
background-color: #CCCCCC;
text-align: left;
padding-left: 8px;
padding-bottom: 5px;
padding-top: 2px;
font-weight:bold;
}
#JT_copy p{
margin:3px 0;
}
#JT_copy img{
padding: 1px;
border: 1px solid #CCCCCC;
}
.jTip{
cursor:help;
}
......@@ -40,8 +40,10 @@ function exec_admin_plugin() {
global $couleur_claire;
$commencer_page = charger_fonction('commencer_page', 'inc');
echo $commencer_page(_T('icone_admin_plugin'), "configuration", "plugin");
echo "<style type='text/css'>\n";
$dir_img_pack = _DIR_IMG_PACK;
echo "<link rel='stylesheet' href='".find_in_path('jtip.css')."' type='text/css' media='screen' />";
echo "<script src='"._DIR_JAVASCRIPT."jtip.js' type='text/javascript'></script>";
echo "<style type='text/css'>\n";
echo <<<EOF
div.cadre-padding ul li {
list-style:none ;
......@@ -232,11 +234,9 @@ function affiche_arbre_plugins($liste_plugins,$liste_plugins_actifs){
$maxiter=1000;
echo http_script("
$(document).ready(
function()
{
function(){
$('input.check').click(function(){\$(this).parent().toggleClass('nomplugin_on');});
}
);");
});");
while (count($liste_plugins) && $maxiter--){
// le rep suivant
$dir = dirname(reset($liste_plugins));
......@@ -274,8 +274,13 @@ function ligne_plug($plug_file, $actif, $id){
$s .= "</div>";
}
$etat = 'dev';
if (isset($info['etat']))
$etat = $info['etat'];
$nom = typo($info['nom']);
// puce d'etat du plugin
// <etat>dev|experimental|test|stable</etat>
$s .= "<span class='formInfo'><a href='".generer_url_ecrire('info_plugin',"plug=$plug_file&width=500")."' class='jTip' name=\"".attribut_html($nom)."\" id='aide_$plug_file'>?</a></span>";
$s .= "<span class='$etat'>&nbsp;</span>";
if (!$erreur){
$s .= "<input type='checkbox' name='statusplug_$plug_file' value='O' id='label_$id_input'";
......@@ -284,38 +289,15 @@ function ligne_plug($plug_file, $actif, $id){
}
$id_input++;
$s .= bouton_block_invisible("$plug_file");
//$s .= bouton_block_invisible("$plug_file");
$s .= ($actif?"":"").typo($info['nom']).($actif?"":"");
$s .= $nom;
$s .= "</div>";
// TODO : n'afficher que les actifs, les autres en AHAH
if (true
OR $actif
OR _SPIP_AJAX!=1) # va-t-on afficher le bloc ?
// afficher les details d'un plug en secours
if (_request('plug')==$plug_file)
$s .= affiche_bloc_plugin($plug_file, $info);
return $s;
}
// http://doc.spip.org/@affiche_bloc_plugin
function affiche_bloc_plugin($plug_file, $info) {
$s .= debut_block_invisible("$plug_file");
$s .= "<div class='detailplugin'>";
$s .= _T('version') .' '. $info['version'] . " | <strong>$titre_etat</strong><br/>";
$s .= _T('repertoire_plugins') .' '. $plug_file . "<br/>";
if (isset($info['description']))
$s .= "<hr/>" . propre($info['description']) . "<br/>";
if (isset($info['auteur']))
$s .= "<hr/>" . _T('auteur') .' '. propre($info['auteur']) . "<br/>";
if (isset($info['lien']))
$s .= "<hr/>" . _T('info_url') .' '. propre($info['lien']) . "<br/>";
$s .= "</div>";
$s .= fin_block();
return $s;
}
?>
<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
include_spip('inc/plugin');
function exec_info_plugin() {
$plug = _request('plug');
$info = plugin_get_infos($plug);
ajax_retour(affiche_bloc_plugin($plug_file, $info));
}
?>
\ No newline at end of file
......@@ -441,4 +441,47 @@ function verifie_include_plugins() {
spip_log("desactivation des plugins suite a suppression du repertoire");
}
}
// http://doc.spip.org/@affiche_bloc_plugin
function affiche_bloc_plugin($plug_file, $info) {
// puce d'etat du plugin
// <etat>dev|experimental|test|stable</etat>
$etat = 'dev';
if (isset($info['etat']))
$etat = $info['etat'];
switch ($etat) {
case 'experimental':
$puce = 'puce-rouge.gif';
$titre_etat = _T('plugin_etat_experimental');
break;
case 'test':
$puce = 'puce-orange.gif';
$titre_etat = _T('plugin_etat_test');
break;
case 'stable':
$puce = 'puce-verte.gif';
$titre_etat = _T('plugin_etat_stable');
break;
default:
$puce = 'puce-poubelle.gif';
$titre_etat = _T('plugin_etat_developpement');
break;
}
$s .= "<div class='detailplugin verdana2'>";
$s .= _T('version') .' '. $info['version'] . " | <strong>$titre_etat</strong><br/>";
$s .= _T('repertoire_plugins') .' '. $plug_file . "<br/>";
if (isset($info['description']))
$s .= "<hr/>" . propre($info['description']) . "<br/>";
if (isset($info['auteur']))
$s .= "<hr/>" . _T('auteur') .' '. propre($info['auteur']) . "<br/>";
if (isset($info['lien']))
$s .= "<hr/>" . _T('info_url') .' '. propre($info['lien']) . "<br/>";
$s .= "</div>";
return $s;
}
?>
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter