very long code added in footer !?
-
I notice that there is now a code added in the footer which is more than 200 lines
<script type=”text/javascript”>
/*test*/
function tltpy_fetch_kws(){
/*
array(0) {
}
*/
window.kttg_tab=[
//…….
list of lot of Tootipy
…….//
[“a tooltipy|a tooltipy”,false,false,’tooltipy-kw-cat-196′,”,”,0],
];
tooltipIds=[
“6420”,
“6131”,
“6105”,
“6074”,
“5901”,
“5857”,
“5791”,
“5755”,
“5729”,
“5347”,
“5258”,
“5192”,
“5124”,
“5100”,
“4984”,
“4961”,
“4880”,
“4678”,
“4593”,
“4591”,
“4589”,
“4577”,
“4569”,
“4567”,
“4562”,
“4557”,
“4553”,
“4550”,
“4547”,
“4540”,
“4536”,
“4532”,
“4530”,
“4514”,
“4294”,
“4262”,
“4200”,
“4163”,
“4115”,
“4009”,
“4008”,
“4007”,
“4006”,
“4004”,
“4003”,
“4001”,
“4000”,
“3998”,
“3997”,
“3996”,
“3994”,
“3993”,
“3992”,
“3990”,
“3988”,
“3987”,
“3986”,
“3985”,
“3984”,
“3983”,
“3982”,
“3981”,
“3980”,
“3979”,
“3978”,
“3976”,
“3975”,
“3974”,
“3973”,
“3972”,
“3969”,
“3968”,
“3967”,
“3966”,
“3964”,
“3963”,
“3962”,
“3960”,
“3903”,
];//include or fetch zone
var class_to_cover=[
];
var tags_to_cover=[
];
var areas_to_cover = class_to_cover.concat( tags_to_cover );if(areas_to_cover.length==0){//if no classes mentioned
areas_to_cover.push(“body”);
}fetch_all=”g”;
//exclude zone block
{
var zones_to_exclude=[
“.kttg_glossary_content”, //remove tooltips from inside the glossary content
“#tooltip_blocks_to_show”, //remove tooltips from inside the tooltips
];
zones_to_exclude.push(“h”+1);
zones_to_exclude.push(“h”+2);
zones_to_exclude.push(“h”+3);
zones_to_exclude.push(“h”+4);
zones_to_exclude.push(“h”+5);
zones_to_exclude.push(“h”+6);
}for(var j=0 ; j<areas_to_cover.length ; j++){
/*test overlapping classes*/
var tmp_classes=areas_to_cover.slice(); //affectation par valeur
//remove current elem from tmp tab
tmp_classes.splice(j,1);//if have parents (to avoid overlapping zones)
if(
tmp_classes.length>0
&&
jQuery(areas_to_cover[j]).parents(tmp_classes.join(“,”)).length>0
){
continue;
}
/*end : test overlapping classes*/for(var cls=0 ; cls<jQuery(areas_to_cover[j]).length ; cls++){
zone=jQuery(areas_to_cover[j])[cls];
//to prevent errors in unfound classes
if (zone==undefined) {
continue;
}for(var i=0;i<kttg_tab.length;i++){
suffix=”;
if(kttg_tab[i][2]==true){//if is prefix
suffix=’\\w*’;
}
txt_to_find=kttg_tab[i][0];
var text_sep='[\\s<>,;:!$^*=\\-()\'”&?.\\/§%£¨+°~#{}\\[\\]|`\\\^@¤]’; //text separator//families for class
tooltipy_families_class=kttg_tab[i][3];//video class
tooltipy_video_class=kttg_tab[i][4];/*test japanese and chinese*/
var japanese_chinese=/[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/;
var jc_reg = new RegExp(japanese_chinese);if(jc_reg.test(txt_to_find)){
//change pattern if japanese or chinese text
text_sep=””; //no separator for japanese and chinese
}pattern=text_sep+”(“+txt_to_find+”)”+suffix+””+text_sep+”|^(“+txt_to_find+”)”+suffix+”$|”+text_sep+”(“+txt_to_find+”)”+suffix+”$|^(“+txt_to_find+”)”+suffix+text_sep;
iscase=”;
if(kttg_tab[i][1]==false){
iscase=’i’;
}
var reg=new RegExp(pattern,fetch_all+iscase);if (typeof findAndReplaceDOMText == ‘function’) { //if function exists
findAndReplaceDOMText(zone, {
preset: ‘prose’,
find: reg,
replace: function(portion) {splitted=portion.text.split(new RegExp(txt_to_find,’i’));
txt_to_display=portion.text.match(new RegExp(txt_to_find,’i’));
/*exclude zones_to_exclude*/
zones_to_exclude_string=zones_to_exclude.join(“, “);
if(
jQuery(portion.node.parentNode).parents(zones_to_exclude_string).length>0
||
jQuery(portion.node.parentNode).is(zones_to_exclude_string)
){
return portion.text;
}
/*avoid overlaped keywords*/
if(
jQuery(portion.node.parentNode).parents(“.bluet_tooltip”).length>0
||
jQuery(portion.node.parentNode).is(“.bluet_tooltip”)
){
return portion.text;
}
//number of appearencekttg_tab[i][6]++;
if(splitted[0]!=undefined){ before_kw = ” “; }else{before_kw=””;}
if(splitted[1]!=undefined){ after_kw = ” “; }else{after_kw=””;}if(portion.text!=”” && portion.text!=” ” && portion.text!=”\t” && portion.text!=”\n” ){
//console.log(i+” : (“+splitted[0]+”-[“+txt_to_find+”]-“+splitted[1]+”-“+splitted[2]+”-“+splitted[3]+”)”);
var elem = document.createElement(“span”);if(before_kw==undefined || before_kw==null){
before_kw=””;
}//extract icon if present
kttg_icon=”;if(kttg_tab[i][5]!=””){
kttg_icon=’‘;
}if(suffix!=””){
var reg=new RegExp(suffix,””);
suff_after_kw=after_kw.split(reg)[0];if(after_kw.split(reg)[0]==”” && after_kw.split(reg)[1]!=undefined){
suff_after_kw=after_kw.split(reg)[1];
}if(suff_after_kw==undefined){
suff_after_kw=””;
}just_after_kw=after_kw.match(reg);
if(just_after_kw==undefined || just_after_kw==null){
just_after_kw=””;
}if(suff_after_kw==” “){
suff_after_kw=” “;
}if(before_kw==” “){
before_kw=” “;
}
/*console.log(‘(‘+suffix+’)(‘+after_kw.split(reg)[1]+’)’);
console.log(‘[‘+after_kw+’] -‘+suff_after_kw+’-‘);*///with prefix
elem.innerHTML=(txt_to_display==undefined || txt_to_display==null) ? before_kw+just_after_kw+suff_after_kw : before_kw+”<span class=’bluet_tooltip tooltipy-kw-prefix’ data-tooltip=”+tooltipIds[i]+”>”+kttg_icon+txt_to_display+””+just_after_kw+”</span>”+suff_after_kw;
}else{
if(after_kw==” “){
after_kw=” “;
}if(before_kw==” “){
before_kw=” “;
}
//without prefix
elem.innerHTML=(txt_to_display==undefined || txt_to_display==null) ? before_kw+after_kw : before_kw+”<span class=’bluet_tooltip’ data-tooltip=”+tooltipIds[i]+”>”+kttg_icon+txt_to_display+”</span>”+after_kw;
}
//add classes to keywords
jQuery(jQuery(elem).children(“.bluet_tooltip”)[0]).addClass(“tooltipy-kw tooltipy-kw-“+tooltipIds[i]+” “+tooltipy_families_class+” “+tooltipy_video_class+” “);return elem;
}else{
return “”;
}
}
});
}}
}
}
//trigger event sying that keywords are fetched
jQuery.event.trigger(“keywordsFetched”);
}
/*end test*/jQuery(document).ready(function(){
tltpy_fetch_kws();bluet_placeTooltips(“.bluet_tooltip, .bluet_img_tooltip”,”bottom”,true);
animation_type=”none”;
animation_speed=”kttg_fast”;
moveTooltipElementsTop(“.bluet_block_to_show”);
});jQuery(document).on(“keywordsLoaded”,function(){
bluet_placeTooltips(“.bluet_tooltip, .bluet_img_tooltip”,”bottom”,false);
});/* Lanch keywords fetching for a chosen event triggered – pro feature */
jQuery(“body”).on(‘contentLoaded’,function(){
tltpy_fetch_kws();
});</script>
<script>
jQuery(document).ready(function(){
/*test begin*/
load_tooltip=”<span id=’loading_tooltip’ class=’bluet_block_to_show’ data-tooltip=’0′>”;
load_tooltip+=”<div class=’bluet_block_container’>”;
load_tooltip+=”<div class=’bluet_text_content’>”;
load_tooltip+=”“;
load_tooltip+=”</div>”;
load_tooltip+=”</div>”;
load_tooltip+=”</span>”;jQuery(“#tooltip_blocks_to_show”).append(load_tooltip);
/*test end*/
});
</script>Is it logical and normal?
Thanks for your feedback
- The topic ‘very long code added in footer !?’ is closed to new replies.