diff --git a/v7/tx3_tag_cloud/README.md b/v7/tx3_tag_cloud/README.md new file mode 100644 index 00000000..22ce5198 --- /dev/null +++ b/v7/tx3_tag_cloud/README.md @@ -0,0 +1,11 @@ +Use tx3TagCloud to render our tags in a pretty web: + + * https://github.com/Tuxes3/tx3TagCloud + +**YOU HAVE TO COPY** the template +`tx3_tag_cloud/templates/mako/tags.tmpl` in your THEME folder to make +it work properly. This templates includes the JS and CSS files needed +to render tx3TagCloud and also removes the tags rendered in the old +way. + +Something like: `/themes//templates/` diff --git a/v7/tx3_tag_cloud/conf.py.sample b/v7/tx3_tag_cloud/conf.py.sample new file mode 100644 index 00000000..e69de29b diff --git a/v7/tx3_tag_cloud/files/assets/css/tx3-tag-cloud.css b/v7/tx3_tag_cloud/files/assets/css/tx3-tag-cloud.css new file mode 100644 index 00000000..a346119f --- /dev/null +++ b/v7/tx3_tag_cloud/files/assets/css/tx3-tag-cloud.css @@ -0,0 +1,30 @@ +ul.tx3-tag-cloud +{ + +} + +ul.tx3-tag-cloud li +{ + display: block; + float: left; + list-style: none; + margin-right: 4px; +} + +ul.tx3-tag-cloud li a +{ + display: block; + text-decoration: none; + color: #c9c9c9; + padding: 3px 10px; +} + +ul.tx3-tag-cloud li a:hover +{ + color: #000000; + -webkit-transition: color 250ms linear; + -moz-transition: color 250ms linear; + -o-transition: color 250ms linear; + -ms-transition: color 250ms linear; + transition: color 250ms linear; +} diff --git a/v7/tx3_tag_cloud/files/assets/js/jquery.tx3-tag-cloud.js b/v7/tx3_tag_cloud/files/assets/js/jquery.tx3-tag-cloud.js new file mode 100644 index 00000000..ef72d6ee --- /dev/null +++ b/v7/tx3_tag_cloud/files/assets/js/jquery.tx3-tag-cloud.js @@ -0,0 +1,70 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * Tuxes3 wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return Tuxes3 + * ---------------------------------------------------------------------------- + */ +(function($) +{ + var settings; + $.fn.tx3TagCloud = function(options) + { + + // + // DEFAULT SETTINGS + // + settings = $.extend({ + multiplier : 1 + }, options); + main(this); + + } + + function main(element) + { + // adding style attr + element.addClass("tx3-tag-cloud"); + addListElementFontSize(element); + } + + /** + * calculates the font size on each li element + * according to their data-weight attribut + */ + function addListElementFontSize(element) + { + var hDataWeight = -9007199254740992; + var lDataWeight = 9007199254740992; + $.each(element.find("li"), function(){ + cDataWeight = getDataWeight(this); + if (cDataWeight == undefined) + { + logWarning("No \"data-weight\" attribut defined on
  • element"); + } + else + { + hDataWeight = cDataWeight > hDataWeight ? cDataWeight : hDataWeight; + lDataWeight = cDataWeight < lDataWeight ? cDataWeight : lDataWeight; + } + }); + $.each(element.find("li"), function(){ + var dataWeight = getDataWeight(this); + var percent = Math.abs((dataWeight - lDataWeight)/(lDataWeight - hDataWeight)); + $(this).css('font-size', (1 + (percent * settings['multiplier'])) + "em"); + }); + + } + + function getDataWeight(element) + { + return parseInt($(element).attr("data-weight")); + } + + function logWarning(message) + { + console.log("[WARNING] " + Date.now() + " : " + message); + } + +}(jQuery)); diff --git a/v7/tx3_tag_cloud/files/assets/js/tx3-tag-cloud.js b/v7/tx3_tag_cloud/files/assets/js/tx3-tag-cloud.js new file mode 100644 index 00000000..b3b30f27 --- /dev/null +++ b/v7/tx3_tag_cloud/files/assets/js/tx3-tag-cloud.js @@ -0,0 +1,21 @@ +function create_li_tags() { + $.getJSON("/assets/js/tx3_tag_cloud.json", function(data){ + var items = []; + $.each(data, function(key, val){ + var count = val[0] + var url = val[1] + var posts = val[2] + items.push("
  • " + key + "
  • "); + }); + + $("