4$(document).ready(
function (){
6 ListSymbols=[
"⊕",
"⊖",
"⊗",
"⊘",
"⊙",
"⊚",
"⊛",
"⊜",
"⊝",
7 "①",
"①",
"②",
"③",
"④",
"⑤",
"⑥",
"⑦",
"⑧",
"⑨",
"⑩",
8 "♠",
"♠",
"♡",
"♢",
"♣",
"♤",
"♥",
"♦",
"♧"]
10 rgbFromStr =
function (rgbStr) {
11 return Array.from(rgbStr.replace(
"rgb(",
"").replace(
")",
"").split(
','), x => parseInt(x))
14 ColorSticker =
function(k, floatingTag) {
15 if ( typeof(floatingTag) !=
"undefined" ) {
16 var val=parseFloat(floatingTag[
"val"]);
17 var m = parseFloat(floatingTag[
"m"]);
18 var M = parseFloat(floatingTag[
"M"]);
19 if ( k < ListSymbols.length ) {
20 var symb=ListSymbols[k]
25 if ( k<colorTagStickersTab.length-1 ) {
26 var cm=getRGBColor(colorTagStickersTab[k]);
27 var cM=getRGBColor(colorTagStickersTab[colorTagStickersTab.length-k+1]);
29 cval=InterpolColor(m,val,M,cm,cM)
30 }
else if (k<(colorTagStickersTab.length + colorFilterStickersTab.length - 1 )) {
31 var cm=getRGBColor(colorFilterStickersTab[k -colorTagStickersTab.length]);
32 var cM=getRGBColor(colorFilterStickersTab[colorTagStickersTab.length + colorFilterStickersTab.length - k+1]);
34 cval=InterpolColor(m,val,M,cm,cM)
36 return {
"cm":
"rgb("+cm[0]+
","+cm[1]+
","+cm[2]+
")",
37 "cval":
"rgb("+cval[0]+
","+cval[1]+
","+cval[2]+
")",
38 "cM":
"rgb("+cM[0]+
","+cM[1]+
","+cM[2]+
")",
40 }
else if (k<colorTagStickersTab.length) {
41 return colorTagStickersTab[k];
42 }
else if (k<(colorTagStickersTab.length + colorFilterStickersTab.length)) {
43 return colorFilterStickersTab[k-colorTagStickersTab.length];
45 return "rgb("+Math.floor(Math.random()*255) +
", " + Math.floor(Math.random()*255)+
", " + Math.floor(Math.random()*255)+
")";
49 newTag_conformance =
function(tmpNewTag) {
50 tmpNewTag = tmpNewTag.replace(/\s[+]\s/g,
"_and_");
51 var forbiddenCharacters = [
"'",
"(",
")",
" + ",
" ",
".",
",",
'"',
"@",
"+",
"/",
"*",
"=",
"%",
":",
"__"];
52 var replacementCharacters = [
"",
"",
"",
"_and_",
"_",
"_",
"_",
"",
"_at_",
"_",
"_",
"_",
"_",
"_",
"",
"_"];
54 for(var i=0; i<forbiddenCharacters.length; i++) {
55 while($.inArray(forbiddenCharacters[i], tmpNewTag)!=-1) {
56 tmpNewTag = tmpNewTag.replace(forbiddenCharacters[i],replacementCharacters[i]);
59 tmpNewTag = tmpNewTag.replace(/_+$/g,
"");
60 tmpNewTag = tmpNewTag.replace(/_+/g,
"_");
64 Stickers =
function(id, htmlSupport) {
69 $(
'#'+
id).append(
"<div id=stickers_"+
id +
" class=stickers_zone></div>");
71 $(
'#stickers_'+
id).css({
72 position :
"absolute",
75 left : parseInt($(
'#'+
id).css(
"width")),
77 height : parseInt($(
'#'+
id).css(
"height")),
82 getStickers =
function() {
86 this.getNodeId =
function() {
91 this.getStickerTab =
function() {
92 return stickerTab.toString();
94 this.resetStickerTab =
function() {
95 $(
'#stickers_'+
id).children(
".sticker").remove();
96 return stickerTab = [];
99 this.updateStickers =
function(reset) {
100 if (typeof(reset) !=
"undefined")
101 $(
'#stickers_'+
id).children(
".sticker").remove();
104 var it = $(
'#stickers_'+
id).children(
".sticker").length;
105 while (it < stickerTab.length) {
106 var thisstickerTab=stickerTab[it];
108 var text_ = thisstickerTab[0];
109 var color = thisstickerTab[1];
112 var idSticker = text_ +
"_" + id;
114 $(
'#stickers_'+
id).append(
"<div id='" +idSticker +
"' title='"+text_ +
"' class='"+text_+
" sticker' " +
"name='"+idSticker+
"_"+it+
"' ></div>");
115 $(
'#'+idSticker).css({
117 backgroundColor : color,
120 $(
'#stickers_'+
id).off(
'mouseover').on(
'mouseover',
function() {
121 if (configBehaviour.tooltip) {
122 $(
this).append(
'<div id=tooltip class="tooltipfrom'+
id
123 +
' fg-tooltip ui-widget ui-widget-content ui-corner-all" style="font-size: 40px"></div>');
124 var tooltip=$(
'#tooltip');
125 tooltip.html($(
this).attr(
"title"));
126 $(
this).attr(
"title",
"");
127 tooltip.append(
'<div class="fg-tooltip-pointer-down ui-widget-content"><div class="fg-tooltip-pointer-down-inner"></div></div></div>');
128 tooltip.css(
"top",
"-180px");
130 tooltip.fadeIn(
'500');
131 tooltip.fadeTo(
'10',10);
133 }).off(
'mouseout').on(
'mouseout',
function() {
134 if (configBehaviour.tooltip) {
135 $(
this).attr(
"title",$(
this).children(
'div#tooltip').text());
136 $(
this).children(
'div#tooltip').remove();
140 if ( thisstickerTab.length > 2 ) {
142 $(
'#'+idSticker).html(thisstickerTab[2]);
143 var val=thisstickerTab[5];
144 $(
'#'+idSticker).attr(
'title',val);
146 $(
'#'+idSticker).on({
147 mouseenter:
function() {
148 var idSticker=this.id;
149 var
id=idSticker.replace(/.*_(\D*)/,
"$1");
150 var it=$(
'#'+idSticker).attr(
"name").replace(/.*_(\D*)/,
"$1");
151 var thisstickerTab=stickerTab[it];
152 var color = thisstickerTab[1];
153 var cval=rgbFromStr(color);
154 var cm=thisstickerTab[3];
155 var cM=thisstickerTab[4];
158 $(
'#'+idSticker).css({
161 background :
'linear-gradient(to right,'+cm+
','+cM+
')'
163 $(
'#'+idSticker).css(
'-webkit-transform',
'scale('+stickerscale+
')').css(
'-moz-transform',
'scale('+stickerscale+
')');
164 $(
'#'+idSticker).append(
"<div id='stick"+idSticker+
"' style='color:white' >|</div>");
169 if (cM[0] - cm[0] != 0) {
170 s= s+(cval[0] -cm[0]) / (cM[0] - cm[0]);
173 if (cM[1] - cm[1] != 0) {
174 s= s+(cval[1] -cm[1]) / (cM[1] - cm[1]);
177 if (cM[2] - cm[2] != 0) {
178 s= s+(cval[2] -cm[2]) / (cM[2] - cm[2]);
181 s=s/n * parseInt($(
'#'+idSticker).css(
"width"))
182 $('
#stick'+idSticker).css({
183 position:
"absolute",
189 mouseleave:
function() {
190 var idSticker=this.id;
191 var
id=idSticker.replace(/.*_(\D*)/,
"$1");
192 var it=$(
'#'+idSticker).attr(
"name").replace(/.*_(\D*)/,
"$1");
193 var thisstickerTab=stickerTab[it];
194 var color = thisstickerTab[1];
195 $(
'#'+idSticker).css(
'-webkit-transform',
'scale('+1.+
')').css(
'-moz-transform',
'scale('+1.+
')');
196 $(
'#'+idSticker).css({
200 $(
'#'+idSticker).children().remove();
205 $(
'#'+idSticker).off(
"click").on({
214 this.addSticker =
function(text_, color, updateAll, outColors, val) {
216 for (var i=0;i<stickerTab.length;i++) {
218 if (stickerTab[i][0]==text_ && stickerTab[i][1] == color) {
224 if (typeof(outColors) !=
"undefined") {
225 stickerTab.push([text_, outColors[
"cval"], outColors[
"symb"], outColors[
"cm"], outColors[
"cM"], val]);
227 stickerTab.push([text_, color]);
231 this.updateStickers(
true);
234 this.removeSticker =
function(text_,updateAll) {
235 var color = attributedTagsColorsArray[text_];
238 for (var i=0;i<stickerTab.length;i++) {
240 if (stickerTab[i][0]==text_ && stickerTab[i][1] == color) {
247 stickerTab.splice(index, 1);
250 this.updateStickers(
true);
253 this.colorSticker =
function(text_, color) {
254 if($(
'#stickers_'+
id).children(
"."+text_).length != 0) {
256 while (it < stickerTab.length) {
257 if ( text_ == stickerTab[it][0] ) {
258 stickerTab[it][1] = color;
264 $(
'#'+ text_ +
"_" +
id).css({
265 backgroundColor : color,