Last active
April 12, 2021 08:50
-
-
Save Etana/d5160f0bc6a6c36441f80ecfef600d86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html id="min-width" xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr"> | |
<head> | |
<title>Page de listing</title> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" /> | |
<style type="text/css"> | |
a | |
{ | |
text-decoration: none; | |
font-family: font-family: Roboto, sans-serif; | |
color: #666; | |
} | |
body, | |
textarea, | |
input { | |
color: #4499bb; | |
font-size: 12px; | |
font-family: Roboto, sans-serif; | |
} | |
.panelindex { | |
background-color: #f8f8f8; | |
border-radius: 3px; | |
box-shadow: 0 1px 6px rgb(0 0 0 / 6%); | |
color: #444; | |
margin-bottom: 24px; | |
margin-right: auto; | |
margin-left: auto; | |
overflow: hidden; | |
padding: 18px 18px 0; | |
position: relative; | |
width:70%; | |
} | |
.panelmain { | |
margin: -9px -18px 18px; | |
} | |
.panel-title { | |
border-bottom: none; | |
color: #444; | |
margin-bottom: 9px; | |
margin-left: 18px; | |
margin-top: 3px; | |
padding: 0; | |
font-size: 1.6em; | |
font-weight: 400; | |
font-family: Roboto, sans-serif; | |
} | |
.panelfull { | |
background-color: #fff; | |
border-radius: 3px; | |
box-shadow: 0 1px 6px rgb(0 0 0 / 6%); | |
color: #444; | |
margin-bottom: 10px; | |
overflow: hidden; | |
padding: 0 18px 0; | |
position: relative; | |
} | |
body { | |
background: #39C; | |
} | |
.textarearesult | |
{ | |
border: 1px dotted #666; | |
border-radius: 5px; | |
background: #f8fdff; | |
height:400px; | |
width:100%; | |
color: #330099; | |
font-family:Courier New; | |
} | |
input[disabled] { | |
color: #808080; | |
border-color: #aaa; | |
background-color: #eaeaef; | |
} | |
#note { | |
color: #FFF; | |
font-size: 15px; | |
text-align: center; | |
padding: 5px; | |
background: #39C; | |
margin: 10px auto; | |
width: 80%; | |
border: 1px dotted #8cd; | |
font-weight: bold; | |
border-radius: 15px; | |
} | |
fieldset { | |
border-width: 0; | |
font-family: Roboto, sans-serif; | |
} | |
fieldset dl { | |
padding: 4px 0; | |
} | |
fieldset dt { | |
display: block; | |
float: left; | |
text-align: left; | |
width: 10%; | |
} | |
fieldset dd { | |
margin-bottom: 3px; | |
margin-inline-start: 150px; | |
} | |
dt label { | |
display: block; | |
font-weight: 500; | |
vertical-align:middle; | |
font-weight: bold; | |
text-align: left; | |
} | |
.Affichagecible{ | |
color: #330099; | |
font-family:Courier New; | |
border: 1px solid #666; | |
border-radius: 3px !important; | |
font-size: 12px; | |
height: 30px; | |
margin-bottom: 11px; | |
width: 100%; | |
} | |
.parametrecible{ | |
color: #330099; | |
font-family:Courier New; | |
border: 1px solid #666; | |
border-radius: 3px !important; | |
font-size: 12px; | |
height: 30px; | |
margin-bottom: 11px; | |
width: 20%; | |
} | |
.forumcible{ | |
border: 1px solid #e9553c; | |
border-radius: 3px !important; | |
font-size: 12px; | |
height: 30px; | |
margin-bottom: 11px; | |
width: 20%; | |
} | |
.Acible{ | |
border: 1px solid #e9553c; | |
border-radius: 3px !important; | |
font-size: 12px; | |
height: 30px; | |
margin-bottom: 11px; | |
width: 20%; | |
} | |
.button { | |
background-color: #1E88E5; | |
background-image: none; | |
border-radius: 4px; | |
border: none; | |
color: #fff; | |
cursor: pointer; | |
font-size: 14px; | |
font-weight: 400; | |
line-height: 1.42857143; | |
margin-bottom: 0; | |
padding: 7px 12px; | |
text-align: center; | |
user-select: none; | |
white-space: nowrap; | |
} | |
.bts-up { | |
background-color: #1E88E5; | |
} | |
.bts-add { | |
background-color: #84c754; | |
} | |
.bts-del { | |
background-color: #e9553c; | |
} | |
</style> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
function my_getcookie(name){cname=name+'=';cpos=document.cookie.indexOf(cname);if(cpos!=-1){cstart=cpos+cname.length;cend=document.cookie.indexOf(";",cstart);if(cend==-1){cend=document.cookie.length}return unescape(document.cookie.substring(cstart,cend))}return null}function my_setcookie(name,value,sticky,path){expires="";domain="";if(sticky){expires="; expires=Wed, 1 Jan 2020 00:00:00 GMT"}if(!path){path="/"}document.cookie=name+"="+value+"; path="+path+expires+domain+';'} | |
var case_insensitive= 2; var no_tag= 3; var no_special_chars= 5; var intelligent= 7; | |
var current=''; var titles= new Array(); var idtitles= new Array(); | |
function treat(str) { | |
if(!(sort_titles_flag%no_tag)) { | |
str= str.replace(/(\(.*?\)|\[.*?\])/g,''); | |
} | |
if(!(sort_titles_flag%case_insensitive)) { | |
str= str.toLowerCase(); | |
} | |
if(!(sort_titles_flag%no_special_chars)) { | |
str= str.replace(/\W/g,''); | |
} | |
return str.replace(/^\s+/g,'').replace(/\s+$/g,'').replace(/\s+/g,' '); | |
} | |
function sort_titles(a,b) { | |
a= treat(a[1]); | |
b= treat(b[1]); | |
if(!(sort_titles_flag%intelligent)) { | |
if((anums= a.match(/\d+/g)) && (bnums= b.match(/\d+/g))) { | |
numsmax= 0; | |
for(key in anums) if(anums[key].length>numsmax) numsmax= anums[key].length; | |
for(key in bnums) if(bnums[key].length>numsmax) numsmax= bnums[key].length; | |
toadd=''; for(var i=1;i<numsmax;i++) toadd+='0'; | |
a= a.replace(/(\d+)/g,toadd+'$1'); | |
b= b.replace(/(\d+)/g,toadd+'$1'); | |
var regex= new RegExp('\\d+(\\d{'+numsmax+'})','g') | |
a= a.replace(regex,'$1'); | |
b= b.replace(regex,'$1'); | |
} | |
} | |
if(a>b) return 1; | |
else if(a.toLowerCase()==b.toLowerCase()) return 0; | |
else return -1; | |
} | |
function getForum() { | |
titles= new Array(); | |
current=''; | |
idtitles= new Array(); | |
$('#note').text('Index vide'); | |
$('#addb').attr('disabled','disabled'); | |
addForum(); | |
} | |
function addTitle(){ | |
var idtitle= parseInt($(this).attr('href').replace(/^.*\/t([1-9][0-9]*)-.*$/,'$1')); | |
for(val in idtitles) | |
if(idtitles[val]==idtitle) return; | |
idtitles.push(idtitle); | |
var spec= ''; | |
if($(this).closest('dd.dterm').find('strong').not($(this).closest('dd.dterm').find('.span-tab strong,strong.pagination')).length==1) spec= $(this).closest('dd.dterm').find('strong').not($(this).closest('dd.dterm').find('.span-tab strong')).text(); | |
else spec= $(this).closest('dd.dterm').find('.topic-title-container')[0].previousSibling.data.replace(/^\s+/,'').replace(/\s+$/,''); | |
/* (subject id,subject title,author id,author name) */ | |
titles.push(new Array(idtitle,$(this).text(),($(this).parent().parent().parent().find('span.span-tab strong a').length==1?$(this).parent().parent().parent().find('span.span-tab strong a').attr('href').replace(/^.*\/u([1-9][0-9]*)\?change_version=prosilver&change_theme=prosilver/,'$1'):0),$(this).parent().parent().parent().find('span.span-tab strong:first').text(), spec)); | |
}; | |
function addForum() { | |
num_forum= parseInt($('#f').attr('value')); | |
if(!(num_forum>0)) return; | |
$('#note').text('Indexation du forum f'+num_forum+' en cours ( Page 1/? )'); | |
$('#f').attr('value',num_forum); | |
if(current!='') current+=', '; | |
$.get('/f'+num_forum+'-?change_theme=prosilver&change_version=prosilver',function(data){ | |
$(data).find('#main-content a.topictitle').each(addTitle); | |
if(!parseInt($(data).find('.pagination:last a strong:last').text())) { | |
current+= 'f'+num_forum; | |
$('#note').text('Affichage de l\'index '+(current.match(',')?'des forums':'du forum')+' '+current+' ( '+idtitles.length+' sujet'+(idtitles.length>1?'s':'')+' )'); | |
$('#addb').attr('disabled',''); | |
display(); | |
return; | |
} | |
totresult= parseInt($(data).find('.pagination:last a strong:last').text()); | |
result=totresult-1; | |
$('#note').text('Indexation du forum f'+num_forum+' en cours ( Page '+(totresult-result+1)+'/'+totresult+')'); | |
for(var i=1;i<parseInt($(data).find('.pagination:last a strong:last').text());i++) | |
{ | |
$.get('/f'+num_forum+'p'+(parseInt($(data).find('.pagination:last span a:first').attr('href').replace(/^\/f[1-9][0-9]*p([1-9][0-9]*)-.*$/,'$1'))*i)+'-?change_theme=prosilver&change_version=prosilver',function(data2){ | |
$(data2).find('#main-content a.topictitle').each(addTitle); | |
if(--result==0) { | |
current+= 'f'+num_forum; | |
$('#note').text('Affichage de l\'index '+(current.match(',')?'des forums':'du forum')+' '+current+' ( '+idtitles.length+' sujet'+(idtitles.length>1?'s':'')+' )'); | |
$('#addb').attr('disabled',''); | |
display(); | |
} | |
else { | |
$('#note').text('Indexation du forum f'+num_forum+' en cours ( Page '+(totresult-result+1)+'/'+totresult+')'); | |
} | |
}); | |
} | |
}); | |
} | |
function display() { | |
if(idtitles.length==0) return; | |
sort_titles_flag= 1; | |
if($('#nt').attr('checked')) sort_titles_flag*=no_tag; | |
if($('#ci').attr('checked')) sort_titles_flag*=case_insensitive; | |
if($('#nsp').attr('checked')) sort_titles_flag*=no_special_chars; | |
if($('#in').attr('checked')) sort_titles_flag*=intelligent; | |
if($('#rev').attr('checked')) sort_titles_flag*=11; | |
if($('#html').attr('checked')) sort_titles_flag*=13; | |
if($('#spec').attr('checked')) sort_titles_flag*=17; | |
titles.sort(sort_titles); | |
if($('#rev').attr('checked')) titles.reverse(); | |
stocking(); | |
saveAll(); | |
} | |
function getLine(t) { | |
var line= $('#templateLine').attr('value'); | |
line= line.replace(/{TOPICLINK}/g,($('#html').attr('checked')?'<a href=/t{TOPICID}->{TOPICTITLE}</a>':'[url={SITELINK}/t{TOPICID}-]{TOPICTITLE}[/url]')); | |
if(t[2]==0) line= line.replace(/{AUTHORLINK}/g,'{AUTHORNAME}'); | |
else line= line.replace(/{AUTHORLINK}/g,($('#html').attr('checked')?'<a href=/u{AUTHORID}>{AUTHORNAME}</a>':'[url={SITELINK}/u{AUTHORID}]{AUTHORNAME}[/url]')); | |
line= line.replace(/{TOPICID}/g,t[0]); | |
line= line.replace(/{TOPICTITLE}/g,t[1]); | |
line= line.replace(/{AUTHORID}/g,t[2]); | |
line= line.replace(/{AUTHORNAME}/g,t[3]); | |
var sitelink= 'http://'+($('#www').attr('value').replace('http://','').replace(/^\s+/,'').replace(/\s+$/,'')==''?window.location.hostname:$('#www').attr('value').replace('http://','').replace(/^\s+/,'').replace(/\s+$/,'')); | |
line= line.replace(/{SITELINK}/g,sitelink); | |
line= line.replace(/{SPECIAL}/g,t[4]); | |
line= line.replace(/{RETLINE}/g,'\n'); | |
return line; | |
} | |
function getFin() { | |
var fin= $('#templateEnd').attr('value'); | |
var now = new Date(); | |
fin= fin.replace(/{NOWYEAR}/g,now.getFullYear()); | |
fin= fin.replace(/{NOWMONTH}/g,now.getMonth()+1); | |
fin= fin.replace(/{NOWDAY}/g,now.getDate()); | |
fin= fin.replace(/{NOWHOUR}/g,now.getHours()); | |
fin= fin.replace(/{NOWMIN}/g,now.getMinutes()); | |
fin= fin.replace(/{RETLINE}/g,'\n'); | |
return fin; | |
} | |
function getTitle(str) { | |
var title= $('#templateTitle').attr('value'); | |
title= title.replace(/{MAJ}/g,str.toUpperCase()); | |
title= title.replace(/{MIN}/g,str.toLowerCase()); | |
title= title.replace(/{NORMAL}/g,str); | |
title= title.replace(/{RETLINE}/g,'\n'); | |
return title; | |
} | |
function stocking() { | |
$('#result').attr('value',''); | |
var last=0; | |
for(key in titles) { | |
if(titles[key][4]=='' || !$('#spec').attr('checked') || titles[key][4]==$('#spexcl').attr('value')) | |
{ | |
if(last!==treat(titles[key][1]).substr(0,1)) | |
{ | |
last= treat(titles[key][1]).substr(0,1); | |
$('#result').attr('value',$('#result').attr('value')+getTitle(last)); | |
} | |
$('#result').attr('value',$('#result').attr('value')+getLine(titles[key])+'\n'); | |
} | |
} | |
$('#result').attr('value',$('#result').attr('value')+getFin()); | |
} | |
function saveAll() { | |
my_setcookie('indexingtools',escape('{"line":"'+escape($('#templateLine').attr('value'))+'","end":"'+escape($('#templateEnd').attr('value'))+'","title":"'+escape($('#templateTitle').attr('value'))+'","www":"'+escape($('#www').attr('value'))+'","flags":'+sort_titles_flag+',"spexcl":"'+escape($('#spexcl').attr('value'))+'"}'),1,0); | |
} | |
function getAll() { | |
if(!(cook=my_getcookie('indexingtools'))) return; | |
cook= $.parseJSON(cook); | |
$('#templateLine').attr('value',unescape(cook.line)); | |
$('#templateEnd').attr('value',unescape(cook.end)); | |
$('#templateTitle').attr('value',unescape(cook.title)); | |
$('#www').attr('value',unescape(cook.www)); | |
$('#spexcl').attr('value',unescape(cook.spexcl)); | |
sort_titles_flag= parseInt(unescape(cook.flags)); | |
if(!(sort_titles_flag%no_tag)) $('#nt').attr('checked', true); | |
if(!(sort_titles_flag%case_insensitive)) $('#ci').attr('checked', true); | |
if(!(sort_titles_flag%no_special_chars)) $('#nsp').attr('checked', true); | |
if(!(sort_titles_flag%intelligent)) $('#in').attr('checked', true); | |
if(!(sort_titles_flag%11)) $('#rev').attr('checked', true); | |
if(!(sort_titles_flag%13)) { $('#html').attr('checked', true); $('#www').attr('disabled','disabled'); } else $('#www').attr('disabled',''); | |
if(!(sort_titles_flag%17)) { $('#spexcl').attr('disabled',''); $('#spec').attr('checked', true); } else $('#spexcl').attr('disabled','disabled'); | |
} | |
$(function(){ getAll(); }); | |
function resetAll() { | |
document.yeah.reset(); | |
titles= new Array(); | |
current=''; | |
idtitles= new Array(); | |
$('#note').text('Index vide'); | |
$('#sitelink').css('display','inline'); | |
$('#addb').attr('disabled','disabled'); | |
} | |
</script> | |
</head> | |
<body> | |
<div class="panelindex"> | |
<div class="panelmain"> | |
<h1 class="panel-title"><i class="fa fa-gear"></i> Paramétrages</h1> | |
<div class="panelfull"> | |
<form name="yeah"> | |
<fieldset> | |
<dl> | |
<dt> | |
<label>Forum : </label> | |
</dt> | |
<dd> | |
<label><input type="text" id="f" class="forumcible" placeholder="Indiquer le numéro du forum à indexer" /></label> | |
<label><input type="button" value="Charger" class="button bts-up" onClick="getForum()" /></label> | |
<label><input type="button" value="Ajouter" class="button bts-add" onClick="addForum()" id="addb" disabled="disabled" /></label> | |
<label><input type="button" value="Réinitialiser" class="button bts-del" onClick="resetAll()" /></label> | |
</dd> | |
</dl> | |
<dl> | |
<dt> | |
<label>Tri : </label> | |
</dt> | |
<dd> | |
<label><input type="checkbox" id="rev" onChange="display()" /> Inversé</label> | |
<label><input type="checkbox" id="nt" onChange="display()" /> Sans tag</label> | |
<label><input type="checkbox" onChange="display()" id="ci" /> Insensible à la case</label> | |
<label><input type="checkbox" id="nsp" onChange="display()" /> Sans caractères spéciaux</label> | |
<label><input type="checkbox" onChange="display()" id="in" /> Intelligent</label> | |
</dd> | |
</dl> | |
<dl> | |
<dt> | |
<label>Affichage : </label> | |
</dt> | |
<dd> | |
<label>Ligne : <input type="text" class="Affichagecible" onChange="display()" onChange="display()" id="templateLine" value="{TOPICLINK} par [i]{AUTHORLINK}[/i]" /></label><br /> | |
<label>Fin : <input type="text" class="Affichagecible" onChange="display()" id="templateEnd" value="{RETLINE} [right]Mise à jour le {NOWDAY}/{NOWMONTH}/{NOWYEAR}[/right]" /></label><br /> | |
<label>Titre : <input type="text" class="Affichagecible" onChange="display()" id="templateTitle" value="{RETLINE} [center][b][size=16]{MAJ}[/size][/b][/center] {RETLINE}" /></label> | |
</dd> | |
</dl> | |
<dl> | |
<dt> | |
<label>Paramètres : </label> | |
</dt> | |
<dd> | |
<label><input onChange="display()" onClick="if($(this).attr('checked')) $('#www').attr('disabled','disabled'); else $('#www').attr('disabled','');" type="checkbox" id="html" /> HTML</label> | |
<label>ou en utilisant un site pour raccourcir les liens : <input type="text" class="parametrecible" onChange="display()" id="www" value="" /></label><br /> | |
<label><input onChange="display()" onClick="if($(this).attr('checked')) $('#spexcl').attr('disabled',''); else $('#spexcl').attr('disabled','disabled');" type="checkbox" id="spec" /> Sujets normaux avec <input type="text" class="parametrecible" onChange="display()" id="spexcl" value="[ Sondage ]" disabled="disabled" /></label><br /> | |
<span style="float:right;"><a href="https://forum.forumactif.com/t300301-indexation-d-une-section#2631788" target="_blank">→ Consulter le tutoriel sur Forumactif pour comprendre les différents paramétrages.</a></span> | |
</dd> | |
</dl> | |
</fieldset> | |
</div> | |
<h1 class="panel-title"><i class="fa fa-code"></i> Résultat de l'indexation</h1> | |
<div class="panelfull"> | |
<br /> | |
<textarea class="textarearesult" id="result"></textarea> | |
<br /><br /></form> | |
</div> | |
<div id="note">Index vide</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment