Template:tagcloud1

    Table of contents

    {{ var hitShow = true;
    var tagOrder = "name";
    var tagsLimit = 0;
    var tagsToExclude = [""];
    var fontSizeUnits = "%";
    var fontSizeMin = 80;
    var fontSizeMax = 220; 
    var fontColorRMin = 10;
    var fontColorRMax = 60;
    var fontColorGMin = 10;
    var fontColorGMax = 60;
    var fontColorBMin = 50;
    var fontColorBMax = 150;
    var tagListofMaps=site.Tags; 
    var tags = site.Tags;
    var htmlOut="";
     var tmplist; 
     foreach (var tg in tags) { 
          let tmplist ..= [#tg.pages];
    }
     var sorttmplist = list.sort(tmplist);
     var ValueMin = sorttmplist[0];
     var ValueMax = sorttmplist[#sorttmplist-1];
     foreach (var tm in tagListofMaps) { 
         if(#tm.pages < ValueMin)
          {
                let  ValueMin = #tm.pages
          }
          if(#tm.pages > ValueMax)
          {
               let   ValueMax = #tm.pages
          }
        var tag = string.toupperfirst(tm.name);
        var tagURI = web.UriEncode(tag);
        var count = #tm.pages; 
        var weight = ( num.log(count) - num.log(ValueMin) ) / ( num.log(ValueMax) - num.log(ValueMin) );
        var fontSize = fontSizeMin + num.round( (fontSizeMax - fontSizeMin) * weight );   
        var fontColorR = fontColorRMin + num.round( (fontColorRMax - fontColorRMin) * weight );
        var fontColorG = fontColorGMin + num.round( (fontColorGMax - fontColorGMin) * weight );
        var fontColorB = fontColorBMin + num.round( (fontColorBMax - fontColorBMin) * weight );  
          if(hitShow)
            let htmlOut ..="<li style='display: inline-block; font-size:"..fontSize..fontSizeUnits.." '><a href="..site.uri.."Special:Tags?tag="..tagURI.."  style='color:rgb("..fontColorR..","..fontColorG..","..fontColorB..");'>"..tag.."</a><span style='color:rgb("..fontColorR..","..fontColorG..","..fontColorB..");'></span></li> ";
    } web.Html("<div id='tagclouddiv'><ul>"..htmlOut.."</ul></div>"); }}

    Tag page (Edit tags)
    • No tags
    You must login to post a comment.
    Powered by MindTouch Core