SPIP
Documentation
SPIP
Blog
Programmer
Code
Search
Contribution
Contrib
Plugins
Traduire
Forge Git
Entraide
Discuter
IRC
Discord
Découverte
Démo
Syntaxe
Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
spip
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Service d'assistance
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Conditions générales et politique de confidentialité
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
pierretux
spip
Validations
15c24a82
Valider
15c24a82
rédigé
17 years ago
par
renato
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
change name of the jQuery plugin from SEhighlight to SearchHighlight
parent
f8ae05a9
Branches
Branches contenant la validation
Étiquettes
Étiquettes contenant la validation
Aucune requête de fusion associée trouvée
Modifications
3
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
.gitattributes
+1
-1
1 ajout, 1 suppression
.gitattributes
dist/javascript/SearchHighlight.js
+29
-29
29 ajouts, 29 suppressions
dist/javascript/SearchHighlight.js
ecrire/inc/surligne.php
+2
-2
2 ajouts, 2 suppressions
ecrire/inc/surligne.php
avec
32 ajouts
et
32 suppressions
.gitattributes
+
1
−
1
Voir le fichier @
15c24a82
...
...
@@ -229,7 +229,7 @@ dist/inc-petition.html -text
dist/inc-pied.html -text
dist/inc-rss-item.html -text
dist/inc-rubriques.html -text
dist/javascript/S
Eh
ighlight.js -text
dist/javascript/S
earchH
ighlight.js -text
dist/javascript/ajaxCallback.js -text
dist/javascript/articles_tous_edite.js -text
dist/javascript/async_upload.js -text
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
dist/javascript/S
Eh
ighlight.js
→
dist/javascript/S
earchH
ighlight.js
+
29
−
29
Voir le fichier @
15c24a82
/**
* S
Eh
ighlight plugin for jQuery
* S
earchH
ighlight plugin for jQuery
*
* Thanks to Scott Yang <http://scott.yang.id.au/>
* for the original idea and some code
...
...
@@ -39,25 +39,25 @@
*/
(
function
(
$
){
jQuery
.
fn
.
S
Eh
ighlight
=
function
(
options
)
{
jQuery
.
fn
.
S
earchH
ighlight
=
function
(
options
)
{
var
ref
=
options
.
debug_referrer
||
document
.
referrer
;
if
(
!
ref
&&
options
.
keys
==
undefined
)
return
this
;
S
Eh
ighlight
.
options
=
$
.
extend
({
exact
:
"
exact
"
,
style_name
:
'
hilite
'
,
style_name_suffix
:
true
},
options
);
S
earchH
ighlight
.
options
=
$
.
extend
({
exact
:
"
exact
"
,
style_name
:
'
hilite
'
,
style_name_suffix
:
true
},
options
);
if
(
options
.
engines
)
S
Eh
ighlight
.
engines
.
unshift
(
options
.
engines
);
var
q
=
options
.
keys
!=
undefined
?
options
.
keys
.
split
(
/
[\s
,
\+\.]
+/
):
S
Eh
ighlight
.
decodeURL
(
ref
,
S
Eh
ighlight
.
engines
);
if
(
options
.
engines
)
S
earchH
ighlight
.
engines
.
unshift
(
options
.
engines
);
var
q
=
options
.
keys
!=
undefined
?
options
.
keys
.
split
(
/
[\s
,
\+\.]
+/
):
S
earchH
ighlight
.
decodeURL
(
ref
,
S
earchH
ighlight
.
engines
);
if
(
q
&&
q
.
join
(
""
))
{
S
Eh
ighlight
.
buildReplaceTools
(
q
);
S
earchH
ighlight
.
buildReplaceTools
(
q
);
return
this
.
each
(
function
(){
var
el
=
this
;
if
(
el
==
document
)
el
=
$
(
"
body
"
)[
0
];
S
Eh
ighlight
.
hiliteElement
(
el
,
q
);
S
earchH
ighlight
.
hiliteElement
(
el
,
q
);
})
}
else
return
this
;
}
var
S
Eh
ighlight
=
{
var
S
earchH
ighlight
=
{
options
:
{},
regex
:
[],
engines
:
[
...
...
@@ -107,22 +107,22 @@
],
matchAccent
:
/
[\x
91
\x
92
\u
2018
\u
2019
\x
C0-
\x
C5
\x
C7-
\x
CF
\x
D1-
\x
D6
\x
D8-
\x
DC
\x
FF
]
/ig
,
replaceAccent
:
function
(
q
)
{
S
Eh
ighlight
.
matchAccent
.
lastIndex
=
0
;
if
(
S
Eh
ighlight
.
matchAccent
.
test
(
q
))
{
for
(
var
i
=
0
,
l
=
S
Eh
ighlight
.
regexAccent
.
length
;
i
<
l
;
i
++
)
q
=
q
.
replace
(
S
Eh
ighlight
.
regexAccent
[
i
][
0
],
S
Eh
ighlight
.
regexAccent
[
i
][
1
]);
S
earchH
ighlight
.
matchAccent
.
lastIndex
=
0
;
if
(
S
earchH
ighlight
.
matchAccent
.
test
(
q
))
{
for
(
var
i
=
0
,
l
=
S
earchH
ighlight
.
regexAccent
.
length
;
i
<
l
;
i
++
)
q
=
q
.
replace
(
S
earchH
ighlight
.
regexAccent
[
i
][
0
],
S
earchH
ighlight
.
regexAccent
[
i
][
1
]);
}
return
q
;
},
buildReplaceTools
:
function
(
query
)
{
re
=
new
Array
();
for
(
var
i
=
0
,
l
=
query
.
length
;
i
<
l
;
i
++
)
{
query
[
i
]
=
S
Eh
ighlight
.
replaceAccent
(
query
[
i
].
toLowerCase
());
query
[
i
]
=
S
earchH
ighlight
.
replaceAccent
(
query
[
i
].
toLowerCase
());
re
.
push
(
query
[
i
]);
}
var
regex
=
re
.
join
(
"
|
"
);
switch
(
S
Eh
ighlight
.
options
.
exact
)
{
switch
(
S
earchH
ighlight
.
options
.
exact
)
{
case
"
exact
"
:
regex
=
'
\\
b(?:
'
+
regex
+
'
)
\\
b
'
;
break
;
...
...
@@ -130,18 +130,18 @@
regex
=
'
\\
b
\\
w*(
'
+
regex
+
'
)
\\
w*
\\
b
'
;
break
;
}
S
Eh
ighlight
.
regex
=
new
RegExp
(
regex
,
"
gi
"
);
S
earchH
ighlight
.
regex
=
new
RegExp
(
regex
,
"
gi
"
);
for
(
var
i
=
0
,
l
=
query
.
length
;
i
<
l
;
i
++
)
{
S
Eh
ighlight
.
subs
[
query
[
i
]]
=
S
Eh
ighlight
.
options
.
style_name
+
(
S
Eh
ighlight
.
options
.
style_name_suffix
?
i
+
1
:
''
);
S
earchH
ighlight
.
subs
[
query
[
i
]]
=
S
earchH
ighlight
.
options
.
style_name
+
(
S
earchH
ighlight
.
options
.
style_name_suffix
?
i
+
1
:
''
);
}
},
nosearch
:
/s
(?:
cript|tyle
)
|textarea/i
,
hiliteElement
:
function
(
el
,
query
)
{
var
startIndex
,
endIndex
,
comment
=
false
,
opt
=
S
Eh
ighlight
.
options
;
var
startIndex
,
endIndex
,
comment
=
false
,
opt
=
S
earchH
ighlight
.
options
;
if
(
!
opt
.
startHighlightComment
||
!
opt
.
stopHighlightComment
)
return
S
Eh
ighlight
.
hiliteTree
(
0
,
el
.
childNodes
.
length
,
el
,
query
);
return
S
earchH
ighlight
.
hiliteTree
(
0
,
el
.
childNodes
.
length
,
el
,
query
);
if
(
$
.
browser
.
msie
)
{
var
item
=
el
.
firstChild
,
i
=
0
,
parents
=
[],
startComment
=
false
;
while
(
item
)
{
...
...
@@ -151,7 +151,7 @@
startIndex
=
i
+
1
;
}
else
if
(
$
.
trim
(
item
.
data
)
==
opt
.
stopHighlightComment
)
{
endIndex
=
i
;
S
Eh
ighlight
.
hiliteTree
(
startIndex
,
endIndex
,
item
.
parentNode
,
query
);
S
earchH
ighlight
.
hiliteTree
(
startIndex
,
endIndex
,
item
.
parentNode
,
query
);
startComment
=
false
;
}
}
...
...
@@ -182,25 +182,25 @@
startIndex
++
;
}
else
if
(
$
.
trim
(
currComment
.
data
)
==
opt
.
stopHighlightComment
)
{
while
(
el
.
childNodes
[
endIndex
-
1
]
!=
currComment
)
endIndex
--
;
S
Eh
ighlight
.
hiliteTree
(
startIndex
,
endIndex
,
el
,
query
);
S
earchH
ighlight
.
hiliteTree
(
startIndex
,
endIndex
,
el
,
query
);
}
}
}
if
(
!
comment
)
S
Eh
ighlight
.
hiliteTree
(
0
,
el
.
childNodes
.
length
,
el
,
query
);
if
(
!
comment
)
S
earchH
ighlight
.
hiliteTree
(
0
,
el
.
childNodes
.
length
,
el
,
query
);
},
hiliteTree
:
function
(
startIndex
,
endIndex
,
el
,
query
)
{
var
matchIndex
=
S
Eh
ighlight
.
options
.
exact
==
"
whole
"
?
1
:
0
;
var
matchIndex
=
S
earchH
ighlight
.
options
.
exact
==
"
whole
"
?
1
:
0
;
for
(;
startIndex
<
endIndex
;
startIndex
++
)
{
var
item
=
el
.
childNodes
[
startIndex
];
if
(
item
.
nodeType
!=
8
)
{
//comment node
//text node
if
(
item
.
nodeType
==
3
)
{
var
text
=
item
.
data
,
textNoAcc
=
S
Eh
ighlight
.
replaceAccent
(
text
);
var
text
=
item
.
data
,
textNoAcc
=
S
earchH
ighlight
.
replaceAccent
(
text
);
var
newtext
=
""
,
match
,
index
=
0
;
S
Eh
ighlight
.
regex
.
lastIndex
=
0
;
while
(
match
=
S
Eh
ighlight
.
regex
.
exec
(
textNoAcc
))
{
S
earchH
ighlight
.
regex
.
lastIndex
=
0
;
while
(
match
=
S
earchH
ighlight
.
regex
.
exec
(
textNoAcc
))
{
newtext
+=
text
.
substr
(
index
,
match
.
index
-
index
)
+
'
<span class="
'
+
S
Eh
ighlight
.
subs
[
match
[
matchIndex
].
toLowerCase
()]
+
'
">
'
+
text
.
substr
(
match
.
index
,
match
[
0
].
length
)
+
"
</span>
"
;
S
earchH
ighlight
.
subs
[
match
[
matchIndex
].
toLowerCase
()]
+
'
">
'
+
text
.
substr
(
match
.
index
,
match
[
0
].
length
)
+
"
</span>
"
;
index
=
match
.
index
+
match
[
0
].
length
;
}
if
(
newtext
)
{
...
...
@@ -212,8 +212,8 @@
$
(
item
).
before
(
repl
).
remove
();
}
}
else
{
if
(
item
.
nodeType
==
1
&&
item
.
nodeName
.
search
(
S
Eh
ighlight
.
nosearch
)
==-
1
)
S
Eh
ighlight
.
hiliteTree
(
0
,
item
.
childNodes
.
length
,
item
,
query
);
if
(
item
.
nodeType
==
1
&&
item
.
nodeName
.
search
(
S
earchH
ighlight
.
nosearch
)
==-
1
)
S
earchH
ighlight
.
hiliteTree
(
0
,
item
.
childNodes
.
length
,
item
,
query
);
}
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
ecrire/inc/surligne.php
+
2
−
2
Voir le fichier @
15c24a82
...
...
@@ -44,10 +44,10 @@ function surligner_mots($page) {
if
(
preg_match
(
$engine
[
0
],
$ref
))
if
(
preg_match
(
$engine
[
1
],
$ref
,
$match
))
{
//good referrer found
$script
=
"<script src='"
.
find_in_path
(
"javascript/S
Eh
ighlight.js"
)
.
"'></script>
$script
=
"<script src='"
.
find_in_path
(
"javascript/S
earchH
ighlight.js"
)
.
"'></script>
<script type='text/javascript'>
jQuery(function(){
jQuery(document).S
Eh
ighlight({
jQuery(document).S
earchH
ighlight({
style_name:'spip_surligne',
exact:'whole',
style_name_suffix:false,
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter